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

cmd/link: .go.buildinfo is gc'ed by --gc-sections [1.20 backport] #58224

Closed
gopherbot opened this issue Feb 1, 2023 · 2 comments
Closed

cmd/link: .go.buildinfo is gc'ed by --gc-sections [1.20 backport] #58224

gopherbot opened this issue Feb 1, 2023 · 2 comments
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@rsc requested issue #58222 to be considered for backport to the next 1.20 minor release.

@gopherbot please backport go1.19 go1.20

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Feb 1, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Feb 1, 2023
@gopherbot gopherbot added this to the Go1.20.1 milestone Feb 1, 2023
@dr2chase dr2chase added the CherryPickApproved Used during the release process for point releases label Feb 8, 2023
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Feb 8, 2023
@gopherbot
Copy link
Author

Change https://go.dev/cl/464796 mentions this issue: [release-branch.go1.20] cmd/link: keep go.buildinfo even with --gc-sections

@gopherbot
Copy link
Author

Closed by merging fbba58a to release-branch.go1.20.

gopherbot pushed a commit that referenced this issue Feb 10, 2023
…ctions

If you use an external linker with --gc-sections, nothing refers
to .go.buildinfo, so the section is deleted, which in turns makes
'go version' fail on the binary. It is important for vulnerability
scanning and the like to be able to run 'go version' on any binary.

Fix this by inserting a reference to .go.buildinfo from the rodata
section, which will not be GC'ed.

Fixes #58222.
Fixes #58224.

Change-Id: I1e13e9464acaf2f5cc5e0b70476fa52b43651123
Reviewed-on: https://go-review.googlesource.com/c/go/+/464435
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/464796
romaindoumenc pushed a commit to TroutSoftware/go that referenced this issue Feb 14, 2023
…ctions

If you use an external linker with --gc-sections, nothing refers
to .go.buildinfo, so the section is deleted, which in turns makes
'go version' fail on the binary. It is important for vulnerability
scanning and the like to be able to run 'go version' on any binary.

Fix this by inserting a reference to .go.buildinfo from the rodata
section, which will not be GC'ed.

Fixes golang#58222.
Fixes golang#58224.

Change-Id: I1e13e9464acaf2f5cc5e0b70476fa52b43651123
Reviewed-on: https://go-review.googlesource.com/c/go/+/464435
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/464796
@golang golang locked and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants