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

Cannot extract go version info on minimal/reproducible/stripped binaries built with go1.14+ #14

Open
liggitt opened this issue Sep 10, 2020 · 3 comments · May be fixed by #17
Open

Cannot extract go version info on minimal/reproducible/stripped binaries built with go1.14+ #14

liggitt opened this issue Sep 10, 2020 · 3 comments · May be fixed by #17

Comments

@liggitt
Copy link

liggitt commented Sep 10, 2020

This worked on go1.13:

docker run -it --entrypoint=bash golang:1.13
$ go get -d rsc.io/goversion
$ go install -ldflags="-s -w -buildid=" rsc.io/goversion
$ goversion `which goversion`
/go/bin/goversion go1.13.15

But on 1.14+, the same steps result in an error about there being no symbol section:

docker run -it --entrypoint=bash golang:1.14
$ go get -d rsc.io/goversion
$ go install -ldflags="-s -w -buildid=" rsc.io/goversion
$ goversion `which goversion`
/go/bin/goversion: no symbol section

On 1.15:

docker run -it --entrypoint=bash golang:1.15
$ go get -d rsc.io/goversion
$ go install -ldflags="-s -w -buildid=" rsc.io/goversion
$ goversion `which goversion`
/go/bin/goversion: no symbol section
@liggitt
Copy link
Author

liggitt commented Sep 10, 2020

testcases for default and symbol-stripped builds using standard/boringcrypto go versions 1.9-1.15 at #15

@listx
Copy link

listx commented Sep 25, 2020

FTR the -s flag is specifically for omitting the symbol table so it would appear that the 1.14 and 1.15 golang compilers are actually working correctly.

@liggitt
Copy link
Author

liggitt commented Sep 30, 2020

yeah, this library has the ability to extract version info directly from well-known assembly produced by the go compiler. it appears that needs updating for go 1.14+

FiloSottile added a commit to FiloSottile/goversion that referenced this issue Dec 15, 2020
Imported the cmd/go/internal/version implementation at
c32140fa94cfc51a2152855825f57e27ae3ba133, and restored Symbols and
TextRange to implement the gccgo and crypto checks.

It looks like the amd64 matching had broken, but it should be more
stable to just track what we do upstream with minimal modifications, so
I replaced the core mechanism rather than fixing the matcher.

Fixes rsc#14
Fixes rsc#12
Fixes rsc#11
Fixes rsc#7
Closes rsc#13
Closes rsc#9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants