mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
debug/macho: filter non-external symbols when reading imported symbols without LC_DYSYMTAB
File.ImportedSymbols will return symbols with a type that has one of the N_STAB (0xe0) bits set and no section. That's not the expected behavior, as those symbols might not be external. We should expand the type check to also account for the N_EXT bit. The section check is not necessary, as N_EXT symbols never have it set. I have found this issue in the wild by running "go tool cgo -dynimport", but unfortuantely I couldn't get a minimal C code that generates N_STAB symbols without section, so this CL doesn't add any new test. Change-Id: Ib0093ff66b50c7cc2f39d83936314fc293236917 Reviewed-on: https://go-review.googlesource.com/c/go/+/702296 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
2009e6c596
commit
253dd08f5d
1 changed files with 2 additions and 1 deletions
|
|
@ -735,9 +735,10 @@ func (f *File) ImportedSymbols() ([]string, error) {
|
|||
const (
|
||||
N_TYPE = 0x0e
|
||||
N_UNDF = 0x0
|
||||
N_EXT = 0x01
|
||||
)
|
||||
for _, s := range st.Syms {
|
||||
if s.Type&N_TYPE == N_UNDF && s.Sect == 0 {
|
||||
if s.Type&N_TYPE == N_UNDF && s.Type&N_EXT != 0 {
|
||||
all = append(all, s.Name)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue