https://sourceware.org/bugzilla/show_bug.cgi?id=34177
Bug ID: 34177
Summary: [RISC-V ld] missing second pass relax to compressed
jumps
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: l784896635 at gmail dot com
Target Milestone: ---
During RISC-V linker regression/conformance testing, I reduced this
linker-stage issue.
## Actual behavior
GNU ld.bfd stops after the first relaxation pass and leaves the critical site
as 32-bit jal zero / jal ra, while ld.lld reaches the 16-bit c.j / c.jal form
on the same legal inputs.
## Expected behavior
The linker should produce the semantically correct RISC-V output for this
reduced testcase, or issue a controlled diagnostic when the input is outside
the supported semantics. It should not silently emit a wrong output, lose
required metadata/relocations/attributes, miss a required relaxation, report a
false range/non-PIC/non-convergence error, or crash.
## Test input and intent
A series of call/jump sites become shorter after ordinary relaxation, making a
later critical site eligible for a second relaxation from jal/j to c.jal/c.j.
The linker should continue until the compressed form is reached.
## Target and route
- Target tracker: GNU binutils / ld
- Target ISA / ABI: `rv64ic for j-to-cj and rv32ic for jal-to-cjal` /
`lp64/ilp32`
- First failing stage: link
- Toolchain route used in reduction: gas+ld.bfd with gas+ld.lld control
## Reproduction evidence
3 clean reproductions in packaged run1..run3 evidence show stable bfd 32-bit
critical jumps in both the j-to-cj and jal-to-cjal tests, while lld compresses
the matching critical sites.
The reproducer bundle contains the reduced testcase plus three local
reproduction runs. The evidence is text-only: linker outputs, disassembly,
relocation dumps, symbol dumps, and short summaries where available.
Reproducer bundle:
https://github.com/anonymous25989/riscv-linker-48-reproducers/raw/main/r48-v2/attachments/gnu_006_missing_second_pass_relax_to_compressed_jumps_reproducer.zip
## Notes
This is reported as a linker-stage behavior defect found during RISC-V linker
regression/conformance testing. The reduced testcase is intentionally small so
that the failure mode is easy to inspect. The attached evidence is already
reproduced; no additional local path or private workspace is required.
--
You are receiving this mail because:
You are on the CC list for the bug.