]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: accept weak dynamic imports
authorAustin Clements <austin@google.com>
Thu, 27 Jun 2019 22:14:03 +0000 (18:14 -0400)
committerAustin Clements <austin@google.com>
Fri, 5 Jul 2019 18:18:28 +0000 (18:18 +0000)
commita2fb5cd823f5223070c3cce741dd5b3879bac21b
tree83e0a091c279cbe766b70953c28c574743c16ca0
parent7aac3436dde7f247e8602f49317c17563def89ab
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>
src/cmd/cgo/out.go