cmd/cgo: accept weak dynamic imports
cgo produces dynamic imports for Go binaries by scanning the dynamic imports table of a binary produced by the system C compiler and linker. Currently, since it uses elf.File.ImportedSymbols, it only reads global symbols. Unfortunately, recent versions of lld emit weak symbol imports for several pthread symbols, which means the cgo tool doesn't emit dynamic imports for them, which ultimately causes linking of cgo binaries to fail. Fix this by using elf.File.DynamicSymbols instead and filtering down to both global and weak symbols. Fixes #31912. Change-Id: If346a7eca6733e3bfa2cccf74a9cda02a3e81d38 Reviewed-on: https://go-review.googlesource.com/c/go/+/184100 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Showing
Please register or sign in to comment