https://sourceware.org/bugzilla/show_bug.cgi?id=34178

            Bug ID: 34178
           Summary: [RISC-V ld] weaker align reloc suppresses stronger
                    norelax balign
           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 links valid input where align_e.o itself has e0 at offset 0x8, but
final output moves e0 to 0x1000e in one-stage links and 0x1000a after -r plus
final link because only the weak ALIGN 2 survives and the later norelax balign
8 is not preserved.

## 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

An input object starts with a legacy-style explicit R_RISCV_ALIGN addend 2 and
later contains a stronger .option norelax .balign 8 before local symbol e0. The
linker must not let the weaker ALIGN consume padding in a way that breaks the
later 8-byte alignment requirement.

## 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

## Reproduction evidence

3 clean reproductions in packaged run1..run3 evidence show stable input offset
e0=0x8, bfd one-stage output e0=0x1000e, bfd two-stage output e0=0x1000a, and
bfd partial-link relocations containing only the weak R_RISCV_ALIGN 2.

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_007_weaker_align_reloc_suppresses_stronger_norelax_balign_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.

Reply via email to