Switching from LD to LLD causes QEMU to crash.
Posted: Wed Apr 23, 2025 11:26 pm
For reference, I am using Clang for my toolchain.
In my CMake file, I am currently using LD with: This works in QEMU.
I want to use LLD with: This completely bricks my kernel with the QEMU message:
(For some reason, CMake INSISTS on using gcc for the linking phase, and won't let me use clang, no matter what I do. While I can use LLD as my linker, I can't force CMake to execute LLD with clang.)
How do I fix this error and utilize LLD without it bricking the kernel?
In my CMake file, I am currently using LD with:
Code: Select all
set(CMAKE_EXE_LINKER_FLAGS "-v -T ${CMAKE_SOURCE_DIR}/${LINKER} -ffreestanding -fno-pie -nostdlib -z notext")
I want to use LLD with:
Code: Select all
set(CMAKE_EXE_LINKER_FLAGS "-v -fuse-ld=lld -Wl,-T,${CMAKE_SOURCE_DIR}/${LINKER} -fno-pie -ffreestanding -nostdlib -Wl,-z,notext -static")
Code: Select all
qemu-system-i386: Error loading uncompressed kernel without PVH ELF Note logout
How do I fix this error and utilize LLD without it bricking the kernel?