Created attachment 888822 [details] emerge --info sys-kernel/gentoo-kernel If gentoo-kernel-6.6.21 (and possibly earlier versions) is compiled using clang/llvm-17 and LTO, the following internal compiler error occurs: ``` 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 -m elf_x86_64 -mllvm -import-instr-limit=5 -z noexecstack -r -o vmlinux.o -T .tmp_initcalls.lds --whole-archive vmlinux.a --no-whole-archive --start-group --end-group 1. Running pass 'Function Pass Manager' on module 'ld-temp.o'. 2. Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@x86_pmu_cancel_txn' #0 0x00007f0a76dd9c02 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x9d9c02) #1 0x00007f0a76dd77c4 llvm::sys::RunSignalHandlers() (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x9d77c4) #2 0x00007f0a76dd7946 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x9d7946) #3 0x00007f0a75e762f0 (/usr/lib64/libc.so.6+0x3a2f0) #4 0x00007f0a77337971 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xf37971) #5 0x00007f0a7733e6b5 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xf3e6b5) #6 0x00007f0a77205acd llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xe05acd) #7 0x00007f0a76f36aba llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xb36aba) #8 0x00007f0a76f36d7b llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xb36d7b) #9 0x00007f0a76f3743f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xb3743f) #10 0x00007f0a7874ecc0 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x234ecc0) #11 0x00007f0a7874f539 llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x234f539) #12 0x00007f0a787450d9 llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x23450d9) #13 0x00007f0a78745503 llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x2345503) #14 0x00007f0a7e36bafd lld::elf::BitcodeCompiler::compile() (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0x16bafd) #15 0x00007f0a7e2e1137 void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::support::endianness)1, true>>(bool) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0xe1137) #16 0x00007f0a7e2ea41d lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0xea41d) #17 0x00007f0a7e2ed007 lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0xed007) #18 0x00007f0a7e2eef42 lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0xeef42) #19 0x00007f0a7e52e332 lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/usr/lib/llvm/17/bin/../lib64/liblldCommon.so.17+0x10332) #20 0x00005e1f3f8f7054 lld_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm/17/bin/ld.lld+0x4054) #21 0x00005e1f3f8f6723 main (/usr/lib/llvm/17/bin/ld.lld+0x3723) #22 0x00007f0a75e602e0 (/usr/lib64/libc.so.6+0x242e0) #23 0x00007f0a75e60399 __libc_start_main (/usr/lib64/libc.so.6+0x24399) #24 0x00005e1f3f8f6765 _start (/usr/lib/llvm/17/bin/ld.lld+0x3765) make[3]: *** [/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.21/work/linux-6.6/scripts/Makefile.vmlinux_o:62: vmlinux.o] Error 139 make[2]: *** [/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.21/work/linux-6.6/Makefile:1146: vmlinux_o] Error 2 make[1]: *** [/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.21/work/linux-6.6/Makefile:234: __sub-make] Error 2 make: *** [Makefile:234: __sub-make] Error 2 ``` This issue is an example of https://github.com/llvm/llvm-project/issues/63422. It's fixed by https://github.com/llvm/llvm-project/commit/f800c1f3b207e7bcdc8b4c7192928d9a078242a0. Afaict, this patch isn't planned to be merged into llvm-17 in upstream. Since emerging the binary sys-devel/llvm package doesn't include this patch, is it possible to include it into ::gentoo?
Created attachment 888823 [details] build log
Created attachment 888824 [details, diff] patch This patch applies to sys-devel/llvm-17.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0324fa3c789398654e760d47b826e831000e0b91 commit 0324fa3c789398654e760d47b826e831000e0b91 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2024-07-15 09:15:58 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2024-07-15 10:51:01 +0000 sys-devel/llvm: Backport a patch to fix kernel build Closes: https://bugs.gentoo.org/927978 Signed-off-by: Michał Górny <mgorny@gentoo.org> sys-devel/llvm/Manifest | 1 + sys-devel/llvm/llvm-17.0.6-r2.ebuild | 542 +++++++++++++++++++++++++++++++++++ 2 files changed, 543 insertions(+)