-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Description
Bug Description
LLD crashes with segfault when linking Linux kernel with LTO enabled, specifically when processing AMD GPU driver code.
Environment
- LLVM Version: [run
ld.lld --version
] - Target: x86_64-unknown-linux-gnu
- Kernel Version: 6.16
- GPU: AMD RX 6950 XT (Navi 21)
- Distribution: CachyOS
Crash Details
Stack dump:
0. Program arguments: ld.lld -m elf_x86_64 -mllvm -import-instr-limit=5 -z noexecstack -r -o drivers/gpu/drm/amd/amdgpu/amdgpu.o @drivers/gpu/drm/amd/amdgpu/amdgpu.mod
Running pass 'Function Pass Manager' on module 'ld-temp.o'.
Running pass 'Machine Block Frequency Analysis' on function '@gfx_v9_0_update_coarse_grain_clock_gating' #0 0x00007fe1734ea01d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.20.1+0x8ea01d) #1 0x00007fe1734e7647 (/usr/lib/libLLVM.so.20.1+0x8e7647) #2 0x00007fe17243e540 (/usr/lib/libc.so.6+0x3e540) #3 0x00007ffc5a2b6110 make[6]: *** [scripts/Makefile.build:502: drivers/gpu/drm/amd/amdgpu/amdgpu.o] Error 139## Reproduction Steps
- Clone CachyOS kernel:
git clone https://github.com/CachyOS/linux-cachyos.git
- Enable LTO in PKGBUILD:
_use_llvm_lto=full
or_use_llvm_lto=thin
- Run
makepkg
to build kernel - Crash occurs during AMD GPU driver linking
Workaround
Using GNU linker (export LLVM=0
) instead of LLD avoids the crash.
Additional Info
- Crash is deterministic and always occurs at same function
- Only affects builds with LTO enabled
- AMD GPU drivers load successfully in current running kernel