Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

features: centralize error semantics, remove maxMiscType, etc. #571

Merged
merged 5 commits into from Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions asm/instruction.go
Expand Up @@ -20,7 +20,7 @@ const InstructionSize = 8
type RawInstructionOffset uint64

var ErrUnsatisfiedMapReference = errors.New("unsatisfied map reference")
var ErrUnsatisfiedReference = errors.New("unsatisfied reference")
var ErrUnsatisfiedProgramReference = errors.New("unsatisfied program reference")

// Bytes returns the offset of an instruction in bytes.
func (rio RawInstructionOffset) Bytes() uint64 {
Expand Down Expand Up @@ -584,7 +584,7 @@ func (insns Instructions) FixupReferences() error {
// no fixup needed
continue
}
return fmt.Errorf("%s at insn %d: symbol %q: %w", ins.OpCode, i, ins.Reference, ErrUnsatisfiedReference)
return fmt.Errorf("%s at insn %d: symbol %q: %w", ins.OpCode, i, ins.Reference, ErrUnsatisfiedProgramReference)
ti-mo marked this conversation as resolved.
Show resolved Hide resolved
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions linker_test.go
Expand Up @@ -74,8 +74,8 @@ func TestForwardFunctionDeclaration(t *testing.T) {

// This program calls an unimplemented forward function declaration.
_, err = NewProgram(spec)
if !errors.Is(err, asm.ErrUnsatisfiedReference) {
t.Fatal("Expected an error wrapping errUnsatisfiedProgram, got:", err)
if !errors.Is(err, asm.ErrUnsatisfiedProgramReference) {
t.Fatal("Expected an error wrapping ErrUnsatisfiedProgramReference, got:", err)
}

// Append the implementation of fwd().
Expand Down
2 changes: 1 addition & 1 deletion prog_test.go
Expand Up @@ -375,7 +375,7 @@ func TestProgramWithUnsatisfiedMap(t *testing.T) {

_, err = NewProgram(progSpec)
if !errors.Is(err, asm.ErrUnsatisfiedMapReference) {
t.Fatal("Expected an error wrapping errUnsatisfiedMapReference, got", err)
t.Fatal("Expected an error wrapping asm.ErrUnsatisfiedMapReference, got", err)
}
t.Log(err)
}
Expand Down