New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/link: dwarf code badly confused by repeated local symbols #21566
Comments
Change https://golang.org/cl/57943 mentions this issue: |
Change https://golang.org/cl/58070 mentions this issue: |
I took a flying leap at this and moved the |
@heschik, I agree, that seems like a correct change to me. And if it fixes this (I don't quite see the connection to |
The DWARF code is mishandling the case when the host object files define multiple (distinct) symbols with the same name. They are mapped to the same DWARF debug symbol, which then appears on the dwarfp list multiple times, which then breaks the code that processes the list. Detect duplicates and skip them, because that's trivial, instead of fixing the underlying problem. See #21566. Change-Id: Ib5a34c891d7c15f4c7bb6239d8f31a1ec767b8bc Reviewed-on: https://go-review.googlesource.com/57943 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change https://golang.org/cl/58630 mentions this issue: |
The DWARF code is mishandling the case when the host object files define multiple (distinct) symbols with the same name. They are mapped to the same DWARF debug symbol, which then appears on the dwarfp list multiple times, which then breaks the code that processes the list. Detect duplicates and skip them, because that's trivial, instead of fixing the underlying problem. See #21566. Change-Id: Ib5a34c891d7c15f4c7bb6239d8f31a1ec767b8bc Reviewed-on: https://go-review.googlesource.com/57943 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/58070 Reviewed-by: Adam Langley <agl@golang.org>
When using -linkmode=internal, the linker's DWARF code gets badly confused if there are local (file-static) symbols in multiple objects with the same name. It creates a symbol go.info.name for each, but without distinct version numbers or any other distinguishing information. Then the code that walks the real symbols and builds a list of DWARF symbols puts the same DWARF symbol onto the list twice. Then the code that assigns DWARF symbols to sections gets confused because it stops when it finds a non-SDWARFINFO symbol, and when it reaches the second instance of a symbol, that symbol has already been converted to SRODATA, so the loop stops prematurely. That in turn causes missing DWARF info.
This only happens with internal linking, and nothing in the standard library happens to link against any code that tickles the bug today, but it certainly could in the future. I ran into this trying to use internal linking with BoringCrypto (much larger than our glibc cgo code).
The last time the linker correctly handled this situation (probably by not trying to collect that DWARF info at all) was Go 1.6.
On dev.boringcrypto I will just skip over the duplicates, which works well enough, but it's not the right fix:
/cc @mwhudson @heschik @dr2chase
The text was updated successfully, but these errors were encountered: