<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/202165>202165</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [RISC-V][lld] ld.lld absolute no relative PIE omits r riscv none placeholders
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          XiaobingHou1219
      </td>
    </tr>
</table>

<pre>
    I ran into this while reducing a RISC-V linker testcase. The reproducer is small, and I have been seeing the same result consistently across three reruns.

### Summary
ld.lld 14.0.6, 15.0.7, 18.1.8, 21.1.3, and 22.1.0 all link the legal PIE successfully but emit no dynamic relocations at all, even though the upstream GNU control `absolute-no-relative.d` requires two `R_RISCV_NONE` placeholder entries in `.rela.dyn`.

### Expected behavior
Link the official GNU `absolute-no-relative` PIE sample, which materializes two link-time absolute symbols with `lga` inside ordinary startup code. The linker should preserve the required placeholder dynamic relocations instead of erasing the dynamic-relocation record entirely.

### Environment
- linker route: GNU as plus ld.lld version replay with official GNU ld legality control
- march: rv64i
- mabi: lp64
- first failing stage: link
- local stability check: True

### Reduced testcase
These are the reduced input files from the minimized reproducer I used locally:

#### `absolute-no-relative.d`
```text
#source: absolute-no-relative.s
#as:
#ld: -Tabsolute-no-relative.ld -pie
#readelf: -Wr

Relocation section '.rela.dyn' at .*
[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
0+[     ]+0+[   ]+R_RISCV_NONE[         ]+0
0+[     ]+0+[   ]+R_RISCV_NONE[         ]+0
```

#### `absolute-no-relative.ld`
```ld
ENTRY(_start)
SECTIONS {
        __symbol_abs__ = 0x1234;
        .text 0x10000 : { *(.text*)}
        .got 0x20000 : { *(.got*) }
}
```

#### `absolute-no-relative.s`
```asm
.text
.global _start
_start:
lga     x1, symbol_abs
lga     x1, __symbol_abs__

.global symbol_abs
.set symbol_abs, 0x100
```

### Reproduction notes
- This packaged root does not have a single canonical `run.ps1` wrapper.
- Use the reduced inputs under `case/` and follow the commands documented in `case/README.md`.
- Stable witness outputs, when present, are preserved under `verify/run1..run3/`.

### What I checked
- Reduced inputs are preserved under case/.
- Stable witness outputs are preserved under verify/run1..run3/.
- The strict recheck says stable normalized run signatures across three runs: True.
- Tracker guidance link: https://llvm.org/docs/HowToSubmitABug.html
- evidence summary: 3 clean reproductions under hunt/verify/lld_absolute_no_relative_placeholders_omitted_in_pie/run1..run3 have identical `out.21.pie.relocs.txt` hashes (`157fc3e2d96eff3c`). In every run, all replayed ld.lld versions exit 0 and each `out.*.pie.relocs.txt` ends with `There are no relocations in this file.` The copied upstream control `absolute-no-relative.d` instead requires two `R_RISCV_NONE` lines, so this is a stable wrong-success linker defect on a legal PIE input.

### Notes
upstream///binutils-gdb/ld/testsuite/ld-riscv-elf/absolute-no-relative.s; D:/search_ascii/upstream///binutils-gdb/ld/testsuite/ld-riscv-elf/absolute-no-relative.ld; D:/search_ascii/upstream///binutils-gdb/ld/testsuite/ld-riscv-elf/absolute-no-relative.d

Root key: `lld.riscv.absolute_no_relative_pie_omits_r_riscv_none_placeholders`
Case id: `20260528-lld-absolute-no-relative-pie-missing-none`

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8V91u67gRfhrlZmBBlmM7vshFchJ3A7Q5ReLdba8MihxZ7KFIlUM68T59MZRkx3uc7rZoFwhiipx_zs9HQaR3FvE2m99n84crEUPj_O3ftHCVtrsfXJyW09VV5dTh9gm8sKBtcBAaTfDWaIPgUUWp7Q4EvDy9fpn8BEbbb-ghIAUpCHPYNEzWeaeiRA-agFphTFZ-AWEVPEEj9ggVogVCZFmhQSDRMhtFE0A6S5oC2mAOIKR3RBAaj0zgo6U8Kx6y4m74X876P3iNbSv8od82KjdGwfQ6L_IF657O8yJfptVNPs1veFVO82k-Gy0ry3yaFyCMSU4lswzuhIG_Pj0CRSmRqI7GHKCKAbDVAawDdbCi1RI8GidF0M4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