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: RISC-V external link, failed to find text symbol for HI20 relocation [1.22 backport] #66060

Closed
gopherbot opened this issue Mar 1, 2024 · 3 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

@cherrymui requested issue #65646 to be considered for backport to the next 1.22 minor release.

I think it is reasonable to backport. Internal linking is not the default mode, and has limitations.

@gopherbot please backport this to Go 1.22. Thanks.

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

Change https://go.dev/cl/568157 mentions this issue: [release-branch.go1.22] cmd/link/internal/riscv64: generate local text symbols for R_RISCV_CALL

@gopherbot gopherbot modified the milestones: Go1.22.1, Go1.22.2 Mar 5, 2024
@mknyszek
Copy link
Contributor

mknyszek commented Mar 6, 2024

This seems safe. The fix is confined to the RISC-V codebase and fixes a real issue (code won't build when externally linked) with no workaround. Approved.

@mknyszek mknyszek added the CherryPickApproved Used during the release process for point releases label Mar 6, 2024
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Mar 6, 2024
gopherbot pushed a commit that referenced this issue Mar 26, 2024
…t symbols for R_RISCV_CALL

Correctly generate local text symbols needed for R_RISCV_CALL when
external linking. R_RISCV_CALL was added in CL #520095 as a way of
marking AUIPC+JALR pairs, instead of overloading R_RISCV_PCREL_ITYPE.
However, genSymsLate was not updated to generate local text symbols
for the new relocation type, leading to HI20 symbol lookup failures.

This issue is detected by cmd/internal/obj/riscv.TestLargeCall,
however this is unfortunately skipped in short mode.

Fixes #66060

Change-Id: I8ee0f13791e0628f31657bf7dae2be8482b689b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/567375
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit b5a64ba)
Reviewed-on: https://go-review.googlesource.com/c/go/+/568157
Reviewed-by: Than McIntosh <thanm@google.com>
@gopherbot
Copy link
Author

Closed by merging 7fb7acb to release-branch.go1.22.

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