Skip to content
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

debug/elf: elf.Symbols() never populates Version or Library struct fields. #50625

Closed
ok-john opened this issue Jan 15, 2022 · 1 comment
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ok-john
Copy link

ok-john commented Jan 15, 2022

What version of Go are you using (go version)?

go1.18-3b5eec9

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

Viewed the elf.Symbol's in both cgo & go elf binaries. See here, the binaries I looked at are included in that repo.

Used ldd to confirm the binaries in question are static and dynamically linked, respectively.

Used readelf -{s, S} to confirm the cgo binary contains no dynamic symbol table unlike the regular go binary.

What did you expect to see?

Well I didn't really expect to see anything, just noticed this in passing & thought it was strange the fields never got populated. Peeking at the Symbol struct I noticed this comment which suggests the Version & Library fields would be populated in the .dynsym table but not in the .symtab table.

Poking around a bit more, looks like there is no attempt to populate either field. (ref)

What did you see instead?

Neither Version or Library populated for either symbol table/binary.

@gopherbot gopherbot added this to the Unreleased milestone Jan 15, 2022
@ok-john ok-john changed the title x/debug: elf.Symbols() never populates Version or Library struct fields. debug/elf: elf.Symbols() never populates Version or Library struct fields. Jan 15, 2022
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 16, 2022
@ianlancetaylor
Copy link
Contributor

The Version and Library fields are set by the DynamicSymbols method: https://go.dev/src/debug/elf/file.go?#L1273, but only if the file has version information. On a Linux system using glibc you will see version information if you use the DynamicSymbols method on libc itself.

In general, for questions about Go please use a forum rather than the issue tracker. Thanks. See https://golang.org/wiki/Questions.

@golang golang locked and limited conversation to collaborators Jan 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants