| Issue |
244372
|
| Summary |
[lld] edge case when output section count crosses SHN_LORESERVE
|
| Labels |
lld
|
| Assignees |
|
| Reporter |
justincady
|
I'm observing a failure when partial linking with high section counts.
I _suspect_ the problem occurs when the total output section count exceeds `SHN_LORESERVE` prior to section pruning, but then ends up under `SHN_LORESERVE` _after_ pruning. I have been unable to confirm that's the exact scenario though.
I used an LLM to create a reproducer script that demonstrates the issue:
```
#!/bin/bash
# Usage: repro.sh [NUM_SECTIONS]
set -eu
cd "$(mktemp -d -p "${TMPDIR:-/tmp}")"
seq -f '.section .s%g,"a"' "${1:-65268}" | llvm-mc -filetype=obj -triple=x86_64 -o in.o
ld.lld -r in.o -o r.o
ld.lld -r r.o -o r2.o && echo "not reproduced"
```
Which reproduces the failure I'm seeing with my production code:
```
$ ./repro.sh
ld.lld: error: r.o: SHT_SYMTAB_SHNDX section is linked with SHT_NULL section (expected SHT_SYMTAB/SHT_DYNSYM)
```
cc @MaskRay @smithp35
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs