diff options
| author | Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net> | 2025-09-10 02:34:03 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-12-01 07:29:29 -0800 |
| commit | eec1afeb28522df37c78c29506ae89233bbce4e9 (patch) | |
| tree | a538fae74bb1dfaf52b8e7d07a986654e3ca89b2 /src | |
| parent | 3f94f3d4b2f03a913de3f5a737bad793418e751f (diff) | |
| download | go-eec1afeb28522df37c78c29506ae89233bbce4e9.tar.xz | |
debug/elf: make check for empty symbol section consistent for 64-bit and 32-bit binaries
The check for whether a binary's symbols section is empty is
inconsistent across the 32-bit and 64-bit flows.
Change-Id: I1abc235320a53cf957cfb83c9e7bcad6e52bc529
GitHub-Last-Rev: f264915ca2964ad8f34ce1deee4f42c2f9dc21bf
GitHub-Pull-Request: golang/go#75334
Reviewed-on: https://go-review.googlesource.com/c/go/+/702195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/debug/elf/file.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/debug/elf/file.go b/src/debug/elf/file.go index 1d56a06c3f..1fc10a5686 100644 --- a/src/debug/elf/file.go +++ b/src/debug/elf/file.go @@ -641,7 +641,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") @@ -690,12 +690,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 { |
