Skip to content

Commit b5a64ba

Browse files
committed
cmd/link/internal/riscv64: generate local text 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 #65646 Change-Id: I8ee0f13791e0628f31657bf7dae2be8482b689b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/567375 Reviewed-by: Mauri de Souza Meneguzzo <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Run-TryBot: Joel Sing <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent cda1e40 commit b5a64ba

File tree

1 file changed

+2
-2
lines changed
  • src/cmd/link/internal/riscv64

1 file changed

+2
-2
lines changed

src/cmd/link/internal/riscv64/asm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ func genSymsLate(ctxt *ld.Link, ldr *loader.Loader) {
170170
relocs := ldr.Relocs(s)
171171
for ri := 0; ri < relocs.Count(); ri++ {
172172
r := relocs.At(ri)
173-
if r.Type() != objabi.R_RISCV_PCREL_ITYPE && r.Type() != objabi.R_RISCV_PCREL_STYPE &&
174-
r.Type() != objabi.R_RISCV_TLS_IE {
173+
if r.Type() != objabi.R_RISCV_CALL && r.Type() != objabi.R_RISCV_PCREL_ITYPE &&
174+
r.Type() != objabi.R_RISCV_PCREL_STYPE && r.Type() != objabi.R_RISCV_TLS_IE {
175175
continue
176176
}
177177
if r.Off() == 0 && ldr.SymType(s) == sym.STEXT {

0 commit comments

Comments
 (0)