-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: linker fails on linux/amd64 when gcc's lto options are used [1.19 backport] #59050
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
For 1.19, it is less of a problem compared to 1.20 (where we stopped shipping binary package archives), but still can be a problem if user explicitly set C flags (e.g. via |
Change https://go.dev/cl/476576 mentions this issue: |
… strange cgo flags seen This patch changes the Go command to examine the set of compiler flags feeding into the C compiler when packages that use cgo are built. If any of a specific set of strange/dangerous flags are in use, then the Go command generates a token file ("preferlinkext") and embeds it into the compiled package's archive. When the Go linker reads the archives of the packages feeding into the link and detects a "preferlinkext" token, it will then use external linking for the program by default (although this default can be overridden with an explicit "-linkmode" flag). The intent here is to avoid having to teach the Go linker's host object reader to grok/understand the various odd symbols/sections/types that can result from boutique flag use, but rather to just boot the objects in question over to the C linker instead. Fixes #59050. Updates #58619. Updates #58620. Updates #58848. Change-Id: I56382dd305de8dac3841a7a7e664277826061eaa Reviewed-on: https://go-review.googlesource.com/c/go/+/475375 Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> (cherry picked from commit 035db07) Reviewed-on: https://go-review.googlesource.com/c/go/+/476576
Closed by merging 2094fd0 to release-branch.go1.19. |
@thanm requested issue #58619 to be considered for backport to the next 1.19 minor release.
The text was updated successfully, but these errors were encountered: