Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 927978 - sys-kernel/gentoo-kernel-6.6.21 will fail to compile with an ICE if llvm-17 is used with LTO
Summary: sys-kernel/gentoo-kernel-6.6.21 will fail to compile with an ICE if llvm-17 i...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-27 17:33 UTC by ppw0
Modified: 2024-03-28 19:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info sys-kernel/gentoo-kernel (emerge_info.log,8.91 KB, text/x-log)
2024-03-27 17:33 UTC, ppw0
Details
build log (build.log.gz,286.44 KB, application/gzip)
2024-03-27 17:35 UTC, ppw0
Details
patch (llvm-issue-63422-PEI-Dont-zero-out-noreg-operands.patch,1.72 KB, patch)
2024-03-27 17:37 UTC, ppw0
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ppw0 2024-03-27 17:33:38 UTC
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?
Comment 1 ppw0 2024-03-27 17:35:36 UTC
Created attachment 888823 [details]
build log
Comment 2 ppw0 2024-03-27 17:37:17 UTC
Created attachment 888824 [details, diff]
patch

This patch applies to sys-devel/llvm-17.