https://sourceware.org/bugzilla/show_bug.cgi?id=34242
Bug ID: 34242
Summary: [RISC-V] GNU ld.bfd RISC-V PLT32 unsupported
relocation
Product: binutils
Version: 2.45
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: l784896635 at gmail dot com
Target Milestone: ---
Created attachment 16754
--> https://sourceware.org/bugzilla/attachment.cgi?id=16754&action=edit
Reduced testcase
I ran into this while reducing a RISC-V linker testcase. I have been seeing the
same result consistently across three reruns.
Observed behavior
=================
GNU ld.bfd 2.45 fails both RV32 and RV64 `R_RISCV_PLT32` objects in both
ET_EXEC and shared links with `internal error: unsupported relocation error`.
ld.lld 22.1.0 links the same objects successfully: ET_EXEC links resolve the
three data words with no remaining relocations, and shared links create
`.plt`/`.got.plt` plus an `R_RISCV_JUMP_SLOT` for default-visible `foo` while
materializing the PLT-relative data words.
Expected behavior
=================
Link RISC-V objects containing standard `R_RISCV_PLT32` data relocations
generated by LLVM MC from `.word %pltpcrel(foo)`, `.word %pltpcrel(foo + 1)`,
and `.word %pltpcrel(foo - 1)`. The current RISC-V psABI defines relocation 59
as `PLT32`, a static `word32` relocation for the 32-bit relative offset to a
function or its PLT entry, so a RISC-V linker should understand this relocation
in ET_EXEC and shared links.
Environment
===========
- product: binutils
- component: ld
- toolchain route: llvm-mc 22 plus current GNU ld.bfd 2.45 with ld.lld 22.1.0
semantic control; GNU as 2.45 syntax does not yet generate `%pltpcrel` and is
not used for the canonical object
- march: rv32 and rv64
- mabi: ELF32/ELF64 RISC-V default object ABI from llvm-mc
- first failing stage: link
Reproduction
============
- The reduced testcase is attached separately as
`078_plt32_unsupported_relocation.zip`.
- The archive contains the source inputs together with the local README/run
wrapper I used when one exists.
- I reran the reduced case three times before filing this report.
Notes
=====
upstream/llvm-project/lld/test/ELF/riscv-reloc-plt32.s is the LLVM/lld semantic
seed; local binutils source evidence is
`upstream/binutils-2.45/include/elf/riscv.h`,
`upstream/binutils-2.45/bfd/elfxx-riscv.c`, and
`upstream/binutils-2.45/bfd/elfnn-riscv.c`.
Root key: bfd.riscv.plt32_unsupported_relocation
Case id: 20260604-bfd-riscv-plt32-unsupported-relocation
--
You are receiving this mail because:
You are on the CC list for the bug.