ClangBuiltLinux / linux

Linux kernel source tree
Other
240 stars 14 forks source link

ld.lld: error: drivers/gpu/drm/nouveau/nouveau.o:(.debug_str): offset is outside the section #2035

Open dileks opened 5 days ago

dileks commented 5 days ago

With Clang-ThinLTO and CONFIG_DEBUG_INFO_BTF=y and CONFIG_DEBUG_INFO_BTF_MODULES=y and CONFIG_DEBUG_INFO_DWARF5=y nouveau kernel-module is BROKEN with Linux v6.9.7:

$ grep nouveau build-log_6.9.7-1-amd64-clang18-kcfi.txt
3343:make -f ./scripts/Makefile.build obj=drivers/gpu/drm/nouveau \
7637:# LD [M]  drivers/gpu/drm/nouveau/nouveau.ko
7638:  ld.lld -r -m elf_x86_64 --thinlto-cache-dir=.thinlto-cache -mllvm -import-instr-limit=5 -z noexecstack --build-id=sha1  -T scripts/module.lds -o drivers/gpu/drm/nouveau/nouveau.ko drivers/gpu/drm/nouveau/nouveau.o drivers/gpu/drm/nouveau/nouveau.mod.o
7654:ld.lld: error: drivers/gpu/drm/nouveau/nouveau.o:(.debug_str): offset is outside the section
7655:make[5]: *** [scripts/Makefile.modfinal:57: drivers/gpu/drm/nouveau/nouveau.ko] Error 1

SLIM LLLVM toolchain version 18.1.8 was used from kernel.org.

Reported upstream (it does not look like a BTF/pahole issue); Link: https://lore.kernel.org/all/CA+icZUU71k9kh3GGc8w=F4rdJeBc3LOPH-gNXrjTTUicnufe5g@mail.gmail.com/

BROKEN linux-config is attached. config-6.9.7-1-amd64-clang18-kcfi.txt

dileks commented 5 days ago

With disabling both modules:

$ scripts/config -d DRM_AMDGPU -d DRM_NOUVEAU

I was able to build and boot into my Debian/unstable AMD64 system:

root# cat /proc/version Linux version 6.9.7-2-amd64-clang18-kcfi (sedat.dilek@gmail.com@iniza) (ClangBuiltLinux clang version 18.1.8 (https://github.com/llvm/llvm-project.git 3b5b5c1ec4a3095a b096dd780e84d7ab81f3d7ff), ClangBuiltLinux LLD 18.1.8)

2~trixie+dileks1 SMP PREEMPT_DYNAMIC 2024-06-30

dileks commented 5 days ago

I tried with and without revert of:

$ git revert f1feed67c79e ( Revert "kbuild: Remove support for Clang's ThinLTO caching" )

dileks commented 5 days ago

@MaskRay

Can you look at this, please?