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: Incorrect symbol linked in darwin/arm64 [1.20 backport] #58954

Closed
gopherbot opened this issue Mar 9, 2023 · 2 comments
Closed

cmd/link: Incorrect symbol linked in darwin/arm64 [1.20 backport] #58954

gopherbot opened this issue Mar 9, 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
Contributor

@cherrymui requested issue #58935 to be considered for backport to the next 1.20 minor release.

@gopherbot please backport this to Go 1.20 release. This could cause binaries to be built incorrectly. Thanks.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Mar 9, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Mar 9, 2023
@gopherbot gopherbot added this to the Go1.20.3 milestone Mar 9, 2023
@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/475175 mentions this issue: [release-branch.go1.20] cmd/link: use label symbols for Duff's devices on darwin/arm64

@cherrymui cherrymui added the CherryPickApproved Used during the release process for point releases label Mar 15, 2023
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Mar 15, 2023
gopherbot pushed a commit that referenced this issue Mar 15, 2023
…s on darwin/arm64

On darwin, the external linker generally supports CALL relocations
with addend. One exception is that for a very large binary when it
decides to insert a trampoline, instead of applying the addend to
the call target (in the trampoline), it applies the addend to the
CALL instruction in the caller, i.e. generating a call to
trampoline+addend, which is not the correct address and usually
points to unreloated functions.

To work around this, we use label symbols so the CALL is targeting
a label symbol without addend. To make things simple we always use
label symbols for CALLs with addend (in external linking mode on
darwin/arm64), even for small binaries.

Updates #58935.
Fixes #58954.

Change-Id: I38aed6b62a0496c277c589b5accbbef6aace8dd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/474620
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Cherry Mui <[email protected]>
Reviewed-by: Than McIntosh <[email protected]>
(cherry picked from commit 7dbd6de)
Reviewed-on: https://go-review.googlesource.com/c/go/+/475175
@gopherbot
Copy link
Contributor Author

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

@golang golang locked and limited conversation to collaborators Mar 14, 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