ITADN

Linux kernel. Can't build with llvm 18.

#1ClosedVeilSilence 创建于 2024-07-17
V
VeilSilencecommented
Greetings. Trying to build kernel with llvm 18, but without success. <details><summary>Details</summary> <p> ```nix PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Running pass 'Function Pass Manager' on module 'vmlinux.a(ip6_input.o at 1076674)'. 1. Running pass 'X86 DAG->DAG Instruction Selection' on function '@ip6_rcv_core' #0 0x00007ffff02dd2de llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0xedd2de) #1 0x00007ffff02da72b SignalHandler(int) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0xeda72b) #2 0x00007fffeee495c0 __restore_rt (/nix/store/m71p7f0nymb19yn1dascklyya2i96jfw-glibc-2.39-52/lib/libc.so.6+0x405c0) #3 0x00007fffeeeaab55 __libc_realloc (/nix/store/m71p7f0nymb19yn1dascklyya2i96jfw-glibc-2.39-52/lib/libc.so.6+0xa1b55) #4 0x00007ffff0243574 llvm::SmallVectorBase<unsigned int>::grow_pod(void*, unsigned long, unsigned long) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0xe43574) #5 0x00007ffff0a4ba44 llvm::SUnit::addPred(llvm::SDep const&, bool) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x164ba44) #6 0x00007ffff0d71caa llvm::ScheduleDAGSDNodes::AddSchedEdges() (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x1971caa) #7 0x00007ffff0d69d22 (anonymous namespace)::ScheduleDAGRRList::Schedule() (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x1969d22) #8 0x00007ffff0e4e59e llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x1a4e59e) #9 0x00007ffff0e50e37 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x1a50e37) #10 0x00007ffff0e5338a llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x1a5338a) #11 0x00007ffff41e4850 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x4de4850) #12 0x00007ffff0807378 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x1407378) #13 0x00007ffff0487d19 llvm::FPPassManager::runOnFunction(llvm::Function&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x1087d19) #14 0x00007ffff048806c llvm::FPPassManager::runOnModule(llvm::Module&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x108806c) #15 0x00007ffff0488a6e llvm::legacy::PassManagerImpl::run(llvm::Module&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x1088a6e) #16 0x00007ffff2180d5c codegen(llvm::lto::Config const&, llvm::TargetMachine*, 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 const&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x2d80d5c) #17 0x00007ffff2181a69 llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::DenseMap<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>>> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>*, std::vector<unsigned char, std::allocator<unsigned char>> const&)::'lambda'(llvm::Module&, llvm::TargetMachine*, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>)::operator()(llvm::Module&, llvm::TargetMachine*, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>) const (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x2d81a69) #18 0x00007ffff218254e llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::DenseMap<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>>> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>*, std::vector<unsigned char, std::allocator<unsigned char>> const&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x2d8254e) #19 0x00007ffff21610e0 (anonymous namespace)::InProcessThinBackend::runThinLTOBackendThread(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&)>, unsigned int, llvm::BitcodeModule, llvm::ModuleSummaryIndex&, llvm::DenseMap<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>>> const&, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo<llvm::ValueInfo, void>> const&, std::map<unsigned long, llvm::GlobalValue::LinkageTypes, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, llvm::GlobalValue::LinkageTypes>>> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>&)::'lambda'(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>)::operator()(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) const (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x2d610e0) #20 0x00007ffff21750a9 std::_Function_handler<void (), std::_Bind<(anonymous namespace)::InProcessThinBackend::start(unsigned int, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>>> const&, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo<llvm::ValueInfo, void>> const&, std::map<unsigned long, llvm::GlobalValue::LinkageTypes, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, llvm::GlobalValue::LinkageTypes>>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>&)::'lambda'(llvm::BitcodeModule, llvm::ModuleSummaryIndex&, llvm::DenseMap<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>>> const&, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo<llvm::ValueInfo, void>> const&, std::map<unsigned long, llvm::GlobalValue::LinkageTypes, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, llvm::GlobalValue::LinkageTypes>>> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>&) (llvm::BitcodeModule, std::reference_wrapper<llvm::ModuleSummaryIndex>, std::reference_wrapper<llvm::DenseMap<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>>> const>, std::reference_wrapper<llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo<llvm::ValueInfo, void>> const>, std::reference_wrapper<std::map<unsigned long, llvm::GlobalValue::LinkageTypes, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, llvm::GlobalValue::LinkageTypes>>> const>, std::reference_wrapper<llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const>, std::reference_wrapper<llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>>)>>::_M_invoke(std::_Any_data const&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0x2d750a9) #21 0x00007ffff019688e std::_Function_handler<void (), llvm::ThreadPool::createTaskAndFuture(std::function<void ()>)::'lambda'()>::_M_invoke(std::_Any_data const&) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0xd9688e) #22 0x00007ffff025f307 llvm::ThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0xe5f307) #23 0x00007ffff025fd68 void* llvm::thread::ThreadProxy<std::tuple<llvm::ThreadPool::grow(int)::'lambda'()>>(void*) (/nix/store/fr74q0nf9wlkfmf1qqmsklykmc09sic6-llvm-18.1.8-lib/lib/libLLVM.so.18.1+0xe5fd68) #24 0x00007fffeee99a42 start_thread (/nix/store/m71p7f0nymb19yn1dascklyya2i96jfw-glibc-2.39-52/lib/libc.so.6+0x90a42) #25 0x00007fffeef1905c __GI___clone3 (/nix/store/m71p7f0nymb19yn1dascklyya2i96jfw-glibc-2.39-52/lib/libc.so.6+0x11005c) /nix/store/m101dg80ngyjdb02g6jwy80sr7kzj26g-bash-5.2p26/bin/bash: line 1: 227071 Segmentation fault (core dumped) /nix/store/8bg6ll2cr9p7kg6ygwn6x3axg57p310g-lld-18.1.8/bin/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 make[2]: *** [../scripts/Makefile.vmlinux_o:62: vmlinux.o] Error 139 make[1]: *** [/build/source/Makefile:1305: vmlinux_o] Error 2 make: *** [../Makefile:240: __sub-make] Error 2 ``` </p> </details> <details><summary>My LLVM stdenv</summary> <p> ```nix { llvmPackages_18, patchelf, overrideCC, pkgs, }: let noBintools = { bootBintools = null; bootBintoolsNoLibc = null; }; hostLLVM = llvmPackages_18.override noBintools; buildLLVM = llvmPackages_18.override noBintools; mkLLVMPlatform = platform: platform // { linux-kernel = platform.linux-kernel // { makeFlags = (platform.linux-kernel.makeFlags or []) ++ [ "LLVM=1" "LLVM_IAS=1" #"V=1" #to test if flags applied "CC=${buildLLVM.clangUseLLVM}/bin/clang" "LD=${buildLLVM.lld}/bin/ld.lld" "HOSTLD=${hostLLVM.lld}/bin/ld.lld" "AR=${buildLLVM.llvm}/bin/llvm-ar" "HOSTAR=${hostLLVM.llvm}/bin/llvm-ar" "NM=${buildLLVM.llvm}/bin/llvm-nm" "STRIP=${buildLLVM.llvm}/bin/llvm-strip" "OBJCOPY=${buildLLVM.llvm}/bin/llvm-objcopy" "OBJDUMP=${buildLLVM.llvm}/bin/llvm-objdump" "READELF=${buildLLVM.llvm}/bin/llvm-readelf" "HOSTCC=${hostLLVM.clangUseLLVM}/bin/clang" "HOSTCXX=${hostLLVM.clangUseLLVM}/bin/clang++" ]; }; }; stdenv' = pkgs.overrideCC hostLLVM.stdenv hostLLVM.clangUseLLVM; in stdenv'.override (old: { hostPlatform = mkLLVMPlatform old.hostPlatform; buildPlatform = mkLLVMPlatform old.buildPlatform; extraNativeBuildInputs = [hostLLVM.lld patchelf]; }) ``` </p> </details> [debug.txt](https://github.com/user-attachments/files/16260519/debug.txt)
关闭于 2024-10-12 7 条评论