]> Cypherpunks repositories - gostls13.git/commit
debug/macho: filter non-external symbols when reading imported symbols without LC_DYS...
authorqmuntal <quimmuntal@gmail.com>
Wed, 10 Sep 2025 11:16:00 +0000 (13:16 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Thu, 11 Sep 2025 09:40:28 +0000 (02:40 -0700)
commit253dd08f5df3a45eafc97eec388636fcabfe0174
tree350aeb85eab292997bf8953deade1ca5cab4e648
parent2009e6c596551673ebb12050daa30171171cb432
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>
src/debug/macho/file.go