https://sourceware.org/bugzilla/show_bug.cgi?id=34175
Bug ID: 34175
Summary: [RISC-V ld] partial link loses start align after relax
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 produces a final executable where symbol b0 moves from an
8-byte-aligned address in the single-stage link to a 4-byte-misaligned address
after the -r two-stage link.
## 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 two-stage firmware link uses GNU ld -r before the final link; a non-relax
section starting with .balign 8 must stay aligned even when a preceding call is
relaxed.
## Target and route
- Target tracker: GNU binutils / ld
- Target ISA / ABI: `rv64imac` / `lp64`
- First failing stage: link
- Toolchain route used in reduction: gas+ld.bfd single-stage vs gas+ld.bfd -r
two-stage control
## Reproduction evidence
3 clean reproductions in packaged run1..run3 evidence show bfd-single placing
b0 at 0x...b8 while bfd-two-stage places b0 at 0x...b4; the only semantic
difference is the introduction of a GNU ld -r stage before the final link.
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_004_partial_link_loses_start_align_after_relax_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.