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/compile: -buildmode=c-archive produces code not suitable for use in a shared object on arm64 [1.21 backport] #63509

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

Comments

@gopherbot
Copy link
Contributor

@cherrymui requested issue #62556 to be considered for backport to the next 1.21 minor release.

@gopherbot please backport this to Go 1.21. This is a regression in Go 1.21 affecting a specific use case without workaround. Thanks.

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

Change https://go.dev/cl/534915 mentions this issue: [release-branch.go1.21] runtime/cgo: avoid taking the address of crosscall2 in code

@dr2chase dr2chase added the CherryPickApproved Used during the release process for point releases label Oct 25, 2023
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Oct 25, 2023
@gopherbot
Copy link
Contributor Author

Closed by merging 7b04d81 to release-branch.go1.21.

gopherbot pushed a commit that referenced this issue Oct 30, 2023
…scall2 in code

Currently, set_crosscall2 takes the address of crosscall2 without
using the GOT, which, on some architectures, results in a
PC-relative relocation (e.g. R_AARCH64_ADR_PREL_PG_HI21 on ARM64)
to the crosscall2 symbol. But crosscall2 is dynamically exported,
so the C linker thinks it may bind to a symbol from a different
DSO. Some C linker may not like a PC-relative relocation to such a
symbol. Using a local trampoline to avoid taking the address of a
dynamically exported symbol.

It may be possible to not dynamically export crosscall2. But this
CL is safer for backport. Later we may remove the trampolines
after unexport crosscall2, if they are not needed.

Fixes #63509.
Updates #62556.

Change-Id: Id28457f65ef121d3f87d8189803abc65ed453283
Reviewed-on: https://go-review.googlesource.com/c/go/+/533535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
(cherry picked from commit 872d718)
Reviewed-on: https://go-review.googlesource.com/c/go/+/534915
Reviewed-by: David Chase <drchase@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

2 participants