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/buildinfo: fall back code for when there's no .go.buildinfo is wrong #73060

Open
gnurizen opened this issue Mar 26, 2025 · 2 comments
Open
Assignees
Labels
BugReport Issues describing a possible bug in the Go implementation. GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@gnurizen
Copy link

Go version

go version go1.24.0 linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/tpr/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/tpr/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2623789763=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/tpr/src/opentelemetry-ebpf-profiler/go.mod'
GOMODCACHE='/home/tpr/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/tpr/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/tpr/sdk/go1.24.0'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/tpr/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/tpr/sdk/go1.24.0/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.0'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Trying to understand go version detection and go version fails to work on go 1.11 and go 1.12 version binaries while the original goversion tool (rsc.io/goversion) does. I chased it to this line:

if p.Type == elf.PT_LOAD && p.Flags&(elf.PF_X|elf.PF_W) == elf.PF_W {

Which should probably be:

			if p.Type == elf.PT_LOAD && p.Flags&(elf.PF_X|elf.PF_W) == 0 {

If I understand things correctly. Not sure if it should be fixed or if the fallback code should just be removed.

What did you see happen?

$ go version hw-go1.11.13
hw-go1.11.13: could not read Go build info from hw-go1.11.13: not a Go executable

What did you expect to see?

rsc.io/goversion tool:

$ goversion hw-go1.11.13
hw-go1.11.13 go1.11.13
@seankhliao seankhliao changed the title debug/build: fall back code for when there's no .go.buildinfo is wrong debug/buildinfo: fall back code for when there's no .go.buildinfo is wrong Mar 26, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Mar 26, 2025
@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Mar 26, 2025
@dmitshur
Copy link
Contributor

CC @matloob, @samthanawalla.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. GoCommand cmd/go 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