cmd/link: issues handling duplicate weak symbols #29563
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
OS-OpenBSD
Milestone
OpenBSD -current now enables
-mretpoline
by default, which results in the compiler emitting a weak__llvm_retpoline_r11
symbol per compilation unit. This results in a cgo package containing multiple files that have the same weak symbol reference, whichcmd/link/internal/loadelf
then fails on:This can also occur with retguard on OpenBSD clang as it emits similar weak symbols per compilation unit, which can then have matching names across files.
I've attempted to construct a test case for this, however it is rather challenging since it really has to be done at the compiler level. The
net.a
case from the above compilation is a useful reference however:I suspect that if the symbols are weak and identical then they should be permitted as duplicates, however I'm not entirely sure what the correct/expected behaviour is here. For the time being I have a diff that matches weak symbols with a prefix of
__llvm_retpoline_
and marks them asDuplicateOK
- this resolves the issue and allows Go to build/pass tests, however it is not really something I'd like to push upstream...The text was updated successfully, but these errors were encountered: