-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: ELF linker generates incorrect local dynamic symbol count #33358
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
Comments
Thanks. I agree that this should be fixed. |
Change https://golang.org/cl/187979 mentions this issue: |
I suspect this won't happen if there's a .dynsym section, but I should mention that if there are no global symbols, this code won't set |
.dynsym section info field is the index of first non-local symbol, mean the number of local symbols. The go linker have never ever set it before, so just set it. Fixes golang#33358 Change-Id: Ifde2deb7c15471b04d565861f5d81daffb0c0d3d Reviewed-on: https://go-review.googlesource.com/c/go/+/187979 Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
@shachaf good catch, fixed in https://go-review.googlesource.com/c/go/+/192600 |
.dynsym section info field is the index of first non-local symbol, mean the number of local symbols. The go linker have never ever set it before, so just set it. Fixes golang#33358 Change-Id: Ifde2deb7c15471b04d565861f5d81daffb0c0d3d Reviewed-on: https://go-review.googlesource.com/c/go/+/187979 Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
When generating a dynamically-linked ELF file, the ".dynsym" section's info field specifies the number of local symbols. It currently seems to generate 0, but symbol 0 is reserved and always local, so the value should be at least 1.
readelf
(from GNU binutils 2.30) reports this warning.What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It is present in master at the time of writing.
See https://github.com/golang/go/blob/master/src/cmd/link/internal/ld/elf.go#L1934
What operating system and processor architecture are you using (
go env
)?linux_amd64
What did you do?
Build a program that uses dynamic linking. E.g.
And look at the .dynsym info field.
What did you expect to see?
.dynsym info field >= 1.
What did you see instead?
.dynsym info field 0, and no warnings from
readelf
.The text was updated successfully, but these errors were encountered: