llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.32k stars 12.11k forks source link

Segmentation fault with thinlto ubuntu clang 17 #73156

Open bemerguy opened 1 year ago

bemerguy commented 1 year ago

Ubuntu clang 17 with lld 17 1:17.0.4~++20231031093940+309d55140c46-1~exp1~20231031093956.26

2965136410638013299 (strlen): Reason = PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /usr/lib/llvm-17/bin/ld.lld -mllvm -mcpu=cortex-a55 -EL -maarch64elf -z norelro --lto-O3 -mllvm -polly -mllvm -polly-run-dce -mllvm -polly-run-inliner -mllvm -polly-isl-arg=--no-schedule-serialize-sccs -mllvm -polly-ast-use-context -mllvm -polly-detect-keep-going -mllvm -polly-vectorizer=stripmine -mllvm -polly-invariant-load-hoisting -mllvm -inline-threshold=125 -mllvm -inlinehint-threshold=2325 -mllvm -inline-cold-callsite-threshold=5 -mllvm -inline-enable-cost-benefit-analysis=true -mllvm -inline-savings-multiplier=10 -mllvm -inlinecold-threshold=5 -mllvm -hot-callsite-threshold=3500 -mllvm -locally-hot-callsite-threshold=525 -mllvm -inline-instr-cost=5 -mllvm -import-instr-limit=50 -mllvm -import-critical-multiplier=600 -mllvm -import-hot-multiplier=150 -mllvm -import-cold-multiplier=1 -mllvm -import-instr-evolution-factor=1 -mllvm -print-import-failures=true -mllvm -print-imports=true --thinlto-cache-dir=.thinlto-cache -r -o vmlinux.o -T .tmp_lto.lds --whole-archive built-in.a --start-group arch/arm64/lib/lib.a lib/lib.a --end-group
 #0 0x00007f44c78d80ea llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcd80ea)
 #1 0x00007f44c78d6324 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcd6324)
 #2 0x00007f44c78d877b (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0xcd877b)
 #3 0x00007f44c6442910 (/lib/x86_64-linux-gnu/libc.so.6+0x42910)
 #4 0x00007f44c65802dd (/lib/x86_64-linux-gnu/libc.so.6+0x1802dd)
 #5 0x00007f44c8979464 (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0x1d79464)
 #6 0x00007f44c89788ee llvm::ComputeCrossModuleImport(llvm::ModuleSummaryIndex const&, llvm::StringMap<llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>>, llvm::MallocAllocator> const&, llvm::function_ref<bool (unsigned long, llvm::GlobalValueSummary const*)>, llvm::StringMap<llvm::StringMap<std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::MallocAllocator>, llvm::MallocAllocator>&, llvm::StringMap<llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo<llvm::ValueInfo, void>>, llvm::MallocAllocator>&) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0x1d788ee)
 #7 0x00007f44c8e6dd72 llvm::lto::LTO::runThinLTO(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&)>, llvm::DenseSet<unsigned long, llvm::DenseMapInfo<unsigned long, void>> const&) (/usr/lib/llvm-17/bin/../lib/libLLVM-17.so.1+0x226dd72)
 #8 0x00007f44c8e6d074 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/../lib/libLLVM-17.so.1+0x226d074)
 #9 0x000055ea9ca03a01 lld::elf::BitcodeCompiler::compile() (/usr/lib/llvm-17/bin/ld.lld+0x20ca01)
#10 0x000055ea9c98c186 void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::support::endianness)1, true>>(bool) (/usr/lib/llvm-17/bin/ld.lld+0x195186)
#11 0x000055ea9c9887e3 lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/usr/lib/llvm-17/bin/ld.lld+0x1917e3)
#12 0x000055ea9c97e8e2 lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/lib/llvm-17/bin/ld.lld+0x1878e2)
#13 0x000055ea9c97d559 lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/usr/lib/llvm-17/bin/ld.lld+0x186559)
#14 0x000055ea9c8d173b lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/usr/lib/llvm-17/bin/ld.lld+0xda73b)
#15 0x000055ea9c8d0817 lld_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-17/bin/ld.lld+0xd9817)
#16 0x000055ea9c8d0d96 main (/usr/lib/llvm-17/bin/ld.lld+0xd9d96)
#17 0x00007f44c64280d0 (/lib/x86_64-linux-gnu/libc.so.6+0x280d0)
#18 0x00007f44c6428189 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28189)
#19 0x000055ea9c8d0415 _start (/usr/lib/llvm-17/bin/ld.lld+0xd9415)
../scripts/link-vmlinux.sh: line 101: 168180 Segmentation fault      (core dumped) ${LDFINAL} ${KBUILD_LDFLAGS} -r -o ${1} $(lto_lds) ${objects}
nikic commented 1 year ago

Does this also happens when the polly flags are omitted?

In any case, the linker input would be needed to debug this.