On Sun, Jun 30, 2024 at 10:57 AM Alan Maguire <alan.maguire@xxxxxxxxxx> wrote: > > On 29/06/2024 17:48, Sedat Dilek wrote: > > On Sat, Jun 29, 2024 at 10:13 AM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote: > >> > >> Hi, > >> > >> I wanted to test the impact on build-time with Linux v6.9.7. > >> > >> The motivation was to build with and without this revert: > >> > >> $ git revert f1feed67c79e > >> ( Revert "kbuild: Remove support for Clang's ThinLTO caching" ) > >> > >> As I read about pahole issues with LLVM/Clang and LTO in the > >> ClangBuiltLinux BTS I used pahole/next.git. > >> > >> $ git log --oneline tags/v1.27.. > >> 693522ee3a94 (HEAD -> pahole-next-v1.27-7-g693522ee3a94, > >> origin/tmp.master, origin/next, next) core: Ignore DW_TAG_inheritance > >> with byte_size zero when finding holes > >> 43f9515d8211 dwarf_loader: Print the DWARF offset in > >> tag__print_unsupported_tag() > >> e82a0fdcfb8e dwarf_loader: Simplify tag__print_not_supported() > >> f7e3f0942fed pahole: Bail out when not finding debug anywhere > >> 94a01bde592c dwarf_loader: Add missing cus__add(cus, cu) to > >> cus__merge_and_process_cu() > >> 6a2b27c0f512 core: Initialize cu->node with INIT_LIST_HEAD() > >> 0ce7745fa46d PKG-MAINTAINERS: Add maintainer for nixpkgs package > >> > >> DWARF-v5 was enabled. > >> > >> The slim LLVM toolchain version 18.1.8 from kernel.org was used (Thanks Nathan). > >> Link: https://mirrors.edge.kernel.org/pub/tools/llvm/ > >> > >> This constellation is BROKEN in the modfinal/BTF section: > >> > >> # BTF [M] drivers/gpu/drm/i915/i915.ko > >> if [ ! -f vmlinux ]; then printf "Skipping BTF generation for %s due > >> to unavailability of vmlinux > >> " drivers/gpu/drm/i915/i915.ko 1>&2; else LLVM_OBJCOPY="llvm-objcopy" > >> /opt/pahole/bin/pahole -J --btf_gen_floats -j --lang_exclude=rust > >> --skip_encoding_btf_inconsistent_proto --btf_gen_optimized --btf_base > >> vmlinux drivers/gpu/drm/i915/i915.ko; > >> ./tools/bpf/resolve_btfids/resolve_btfids -b vmlinux > >> drivers/gpu/drm/i915/i915.ko; fi; > >> ld.lld: error: drivers/gpu/drm/nouveau/nouveau.o:(.debug_str): offset > >> is outside the section > >> make[5]: *** [scripts/Makefile.modfinal:57: > >> drivers/gpu/drm/nouveau/nouveau.ko] Error 1 > >> make[5]: *** Waiting for unfinished jobs.... > >> ld.lld: error: drivers/gpu/drm/amd/amdgpu/amdgpu.o:(.debug_info+0x7d117f5): > >> unknown relocation (33554442) against symbol > >> make[5]: *** [scripts/Makefile.modfinal:56: > >> drivers/gpu/drm/amd/amdgpu/amdgpu.ko] Error 1 > >> make[4]: *** [Makefile:1852: modules] Error 2c > >> make[3]: *** [debian/rules:74: build-arch] Error 2 > >> dpkg-buildpackage: error: make -f debian/rules binary subprocess > >> returned exit status 2 > >> make[2]: *** [scripts/Makefile.package:121: bindeb-pkg] Error 2 > >> make[1]: *** [/home/dileks/src/linux/git/Makefile:1541: bindeb-pkg] Error 2 > >> make: *** [Makefile:240: __sub-make] Error 2 > >> > >> Before doing wild experiments I like to see a confirmation of > >> reproducing the ERROR. > >> Nathan, can you support me? > >> My last successful build: Linux-kernel version 6.8.10 using Debian's > >> pahole version 1.26. > >> > >> Attached is my linux-config which is based on Debian's kernel v6.9.7. > >> > >> Thanks. > >> > >> Best regards, > >> -Sedat- > > > > [ Add some BPF/BTF folks ] > > > > I found upstream commit fcd1ed89a0439c45e1336bd9649485c44b7597c7 > > ("kbuild,bpf: Switch to using --btf_features for pahole v1.26 and later") > > > > Can BPF/BTF folk comment? > > > > Hmm, the above commit doesn't look relevant to me; it just switches to > using a different way of expressing command-line parameters for BTF > generation. From the snippet above you either don't have that commit or > are using a pahole < 1.27 since if you had the commit you'd have > "--btf_features=..." on the commandline instead of > "--skip_encoding_btf_inconsistent_proto --btf_gen_optimized". The > relevant errors from the snippet above appear to be > > >> ld.lld: error: drivers/gpu/drm/nouveau/nouveau.o:(.debug_str): offset > >> is outside the section > >> make[5]: *** [scripts/Makefile.modfinal:57: > >> drivers/gpu/drm/nouveau/nouveau.ko] Error 1 > >> make[5]: *** Waiting for unfinished jobs.... > >> ld.lld: error: > drivers/gpu/drm/amd/amdgpu/amdgpu.o:(.debug_info+0x7d117f5): > >> unknown relocation (33554442) against symbol > >> make[5]: *** [scripts/Makefile.modfinal:56: > > > ...neither of which originate in the BTF generation pahole does; this > looks like a linking issue with ld.lld. Now insofar as such an issue > messes up debug info generation it could certainly impact BTF generation > in turn, but I don't see any output that suggest that is happening above > (BTF generation operates upon .debug_info sections once they are > generated but doesn't actually generate them itself). Is there > additional info that points at BTF generation as being the problem here? > Thanks! > > Alan [ CC Fangrui Song - LLVM/ld.lld upstream developer ] Hi Alan, thanks for your response on Sunday - much appreciated. This morning I had a deeper look into the build-log. $ grep amdgpu build-log_6.9.7-1-amd64-clang18-kcfi.txt 2587:make -f ./scripts/Makefile.build obj=drivers/gpu/drm/amd/amdgpu \ 7635:# LD [M] drivers/gpu/drm/amd/amdgpu/amdgpu.ko 7636: 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 /amd/amdgpu/amdgpu.ko drivers/gpu/drm/amd/amdgpu/amdgpu.o drivers/gpu/drm/amd/amdgpu/amdgpu.mod.o 7657:ld.lld: error: drivers/gpu/drm/amd/amdgpu/amdgpu.o:(.debug_info+0x7d117f5): unknown relocation (33554442) against symbol 7658:make[5]: *** [scripts/Makefile.modfinal:56: drivers/gpu/drm/amd/amdgpu/amdgpu.ko] Error 1 $ 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 So, both modules are BROKEN in MODFINAL stage - corresponding amdgpu.ko and nouveau.ko files are NOT generated. In BTF stage this breaks as the ko-files do NOT exist - no processing possible. So, you are absolutely right - no BTF/pahole issue. NOTE: Downgraded pahole to pahole-v1.27-4-gf7e3f0942fed from pahole/next.git 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@iniza:~# cat /proc/version Linux version 6.9.7-2-amd64-clang18-kcfi (sedat.dilek@xxxxxxxxx@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 Maybe, Fangrui can comment on the ld.ldd error-messages? INFO: DWARF-v5 set explicitly via CONFIG_DEBUG_INFO_DWARF5=y $ /opt/llvm/bin/llvm-dwarfdump vmlinux | head -20 | egrep 'debug_info|format|version|DW_AT_producer' vmlinux: file format elf64-x86-64 .debug_info contents: 0x00000000: Compile Unit: length = 0x00000128, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00 00012c) DW_AT_producer ("ClangBuiltLinux clang version 18.1.8 (https://github.com/llvm/llvm-project.git 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)") INFO: Attached are my 2 linux-configs (dot-config file is BROKEN). Later, I will open two bug-reports in ClangBuiltLinux issue-tracker. Best regards, -Sedat-
Attachment:
config-6.9.7-2-amd64-clang18-kcfi
Description: Binary data
Attachment:
dot-config_6.9.7-1-amd64-clang18-kcfi
Description: Binary data