[lld] [ELF] -r: Synthesize R_RISCV_ALIGN at input section start (PR #151639)

Nathan Chancellor via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 9 20:21:24 PDT 2025


nathanchance wrote:

I don't have time to reduce at the moment but I am seeing an issue when linking the Linux kernel's [`arch/riscv/purgatory/purgatory.ro`](https://elixir.bootlin.com/linux/v6.16/source/arch/riscv/purgatory/Makefile) when ThinLTO is enabled after this change.

```
$ make -skj"$(nproc)" ARCH=riscv LLVM=1 O=/tmp/build clean defconfig

$ scripts/config --file /tmp/build/.config -d LTO_NONE -e LTO_CLANG_THIN

$ timeout 30s make -skj"$(nproc)" ARCH=riscv LLVM=1 O=/tmp/build olddefconfig arch/riscv/purgatory/
malloc(): corrupted top size
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ld.lld -melf64lriscv -mllvm -mattr=+c -mllvm -mattr=+relax -mllvm -import-instr-limit=5 -z noexecstack -e purgatory_start -z nodefaultlib arch/riscv/purgatory/purgatory.ro -o arch/riscv/purgatory/purgatory.chk
make[5]: *** [arch/riscv/purgatory/Makefile:104: arch/riscv/purgatory/purgatory.chk] Terminated
make[4]: *** [scripts/Makefile.build:556: arch/riscv/purgatory] Terminated
make[3]: *** [scripts/Makefile.build:556: arch/riscv] Terminated
make[2]: *** [Makefile:2011: .] Terminated
make[1]: *** [Makefile:248: __sub-make] Terminated
make: *** [Makefile:248: __sub-make] Terminated
```

```
# bad: [72a1fd1b43ac4d267d986c87c4e38f91b5bd872d] [AVR][NFC] Add a test for fp16 support (#152708)
# good: [f61526971f9c62118090443c8b97fab07ae9499f] Revert "[WebAssembly] Constant fold wasm.dot" (#152382)
git bisect start '72a1fd1b43ac4d267d986c87c4e38f91b5bd872d' 'f61526971f9c62118090443c8b97fab07ae9499f'
# good: [e977b28c37c174c1b93ad78314650e03b545f560] [InstCombine] Match intrinsic recurrences when known to be hoisted
git bisect good e977b28c37c174c1b93ad78314650e03b545f560
# good: [3a4b351ba18492b990b10fe5401c3bbaabcf2f94] [IR] Introduce the `ptrtoaddr` instruction
git bisect good 3a4b351ba18492b990b10fe5401c3bbaabcf2f94
# good: [8bfb54bab4434ab4eed1398ef46847b30a087bf7] [gn build] Port 4d3feaea66f4
git bisect good 8bfb54bab4434ab4eed1398ef46847b30a087bf7
# bad: [d1827f040f6e056e62cf4158bdf90d0acdf3d287] Add `REQUIRES: riscv` to test added in 151639 to skip the test when riscv is not built. (#152858)
git bisect bad d1827f040f6e056e62cf4158bdf90d0acdf3d287
# bad: [10e146a7161065429629a13f99c179a61ffe7721] [AMDGPU] Fix out of bound physreg tuple condition. NFC. (#152777)
git bisect bad 10e146a7161065429629a13f99c179a61ffe7721
# bad: [97f0ff0c80407adee693436b44e55ededfcd5435] [AVR] Fix Avr indvar detection and strength reduction (missed optimization) (#152028)
git bisect bad 97f0ff0c80407adee693436b44e55ededfcd5435
# good: [1acb1018d2ad8db4aaf5686b4f749e632828e690] [flang][cuda] Set correct bind(c) name for __popc (#152795)
git bisect good 1acb1018d2ad8db4aaf5686b4f749e632828e690
# bad: [6f53f1c8d2bdd13e30da7d1b85ed6a3ae4c4a856] [ELF] -r: Synthesize R_RISCV_ALIGN at input section start
git bisect bad 6f53f1c8d2bdd13e30da7d1b85ed6a3ae4c4a856
# good: [0c139883f4c086444e816f607105a96b617eb4a7] [libc] Fix server code when GPU is acting as the server
git bisect good 0c139883f4c086444e816f607105a96b617eb4a7
# first bad commit: [6f53f1c8d2bdd13e30da7d1b85ed6a3ae4c4a856] [ELF] -r: Synthesize R_RISCV_ALIGN at input section start
```

https://github.com/llvm/llvm-project/pull/151639


More information about the llvm-commits mailing list