Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/debug/elf/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, error) {
return nil, nil, fmt.Errorf("cannot load symbol section: %w", err)
}
if len(data) == 0 {
return nil, nil, errors.New("symbol section is empty")
return nil, nil, ErrNoSymbols
}
if len(data)%Sym32Size != 0 {
return nil, nil, errors.New("length of symbol section is not a multiple of SymSize")
Expand Down Expand Up @@ -689,12 +689,12 @@ func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) {
if err != nil {
return nil, nil, fmt.Errorf("cannot load symbol section: %w", err)
}
if len(data)%Sym64Size != 0 {
return nil, nil, errors.New("length of symbol section is not a multiple of Sym64Size")
}
if len(data) == 0 {
return nil, nil, ErrNoSymbols
}
if len(data)%Sym64Size != 0 {
return nil, nil, errors.New("length of symbol section is not a multiple of Sym64Size")
}

strdata, err := f.stringTable(symtabSection.Link)
if err != nil {
Expand Down