llvm / llvm-project

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

llvm-bolt fails to instrument rustc_driver on aarch64 #89549

Open eggyal opened 4 months ago

eggyal commented 4 months ago
$ llvm-bolt --version
LLVM (http://llvm.org/):
  LLVM version 18.1.1
  Optimized build.
BOLT revision <unknown>

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)

$ llvm-bolt librustc_driver.so -instrument -o librustc_driver-instrumented.so
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: aarch64
BOLT-INFO: BOLT version: <unknown>
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0x3600000, offset 0x3600000
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: forcing -jump-tables=move for instrumentation
BOLT-INFO: disabling -align-macro-fusion on non-x86 platform
 #0 0x000000000091b0d0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/rustroot/bin/llvm-bolt+0x91b0d0)
 #1 0x0000000000919040 SignalHandler(int) Signals.cpp:0:0
 #2 0x0000ffff67384800 (linux-vdso.so.1+0x800)
 #3 0x00000000009e2e80 llvm::bolt::readDWARFExpressionTargetReg(llvm::StringRef) (/rustroot/bin/llvm-bolt+0x9e2e80)
 #4 0x0000000000f6d448 llvm::bolt::(anonymous namespace)::CFISnapshot::advanceTo(int) BinaryFunction.cpp:0:0
 #5 0x0000000000f6f200 llvm::bolt::BinaryFunction::unwindCFIState(int, int, llvm::bolt::BinaryBasicBlock*, __gnu_cxx::__normal_iterator<llvm::MCInst*, std::vector<llvm::MCInst, std::allocator<llvm::MCInst>>>&) (/rustroot/bin/llvm-bolt+0xf6f200)
 #6 0x0000000000f70754 llvm::bolt::BinaryFunction::normalizeCFIState() (/rustroot/bin/llvm-bolt+0xf70754)
 #7 0x0000000000f768ac llvm::bolt::BinaryFunction::buildCFG(unsigned short) (/rustroot/bin/llvm-bolt+0xf768ac)
 #8 0x0000000000969700 std::_Function_handler<void (llvm::bolt::BinaryFunction&, unsigned short), llvm::bolt::RewriteInstance::buildFunctionsCFG()::'lambda'(llvm::bolt::BinaryFunction&, unsigned short)>::_M_invoke(std::_Any_data const&, llvm::bolt::BinaryFunction&, unsigned short&&) RewriteInstance.cpp:0:0
 #9 0x0000000000fa7c2c std::_Function_handler<void (), std::_Bind<llvm::bolt::ParallelUtilities::runOnEachFunctionWithUniqueAllocId(llvm::bolt::BinaryContext&, llvm::bolt::ParallelUtilities::SchedulingPolicy, std::function<void (llvm::bolt::BinaryFunction&, unsigned short)>, std::function<bool (llvm::bolt::BinaryFunction const&)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, unsigned int)::'lambda'(std::_Rb_tree_iterator<std::pair<unsigned long const, llvm::bolt::BinaryFunction>>, std::_Rb_tree_iterator<std::pair<unsigned long const, llvm::bolt::BinaryFunction>>, unsigned short) (std::_Rb_tree_iterator<std::pair<unsigned long const, llvm::bolt::BinaryFunction>>, std::_Rb_tree_iterator<std::pair<unsigned long const, llvm::bolt::BinaryFunction>>, unsigned int)>>::_M_invoke(std::_Any_data const&) ParallelUtilities.cpp:0:0
#10 0x00000000009bbe08 std::_Function_handler<void (), llvm::ThreadPool::createTaskAndFuture(std::function<void ()>)::'lambda'()>::_M_invoke(std::_Any_data const&) (/rustroot/bin/llvm-bolt+0x9bbe08)
#11 0x0000000001b04c2c llvm::ThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) (/rustroot/bin/llvm-bolt+0x1b04c2c)
#12 0x0000000001b053bc void* llvm::thread::ThreadProxy<std::tuple<llvm::ThreadPool::grow(int)::'lambda'()>>(void*) ThreadPool.cpp:0:0
#13 0x0000ffff66e16798 start_thread (/lib64/libc.so.6+0x96798)
#14 0x0000ffff66e81b4c thread_start (/lib64/libc.so.6+0x101b4c)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
yota9 commented 4 months ago

@eggyal Please provide the input binary. @ayermolo

eggyal commented 4 months ago

It contains debug info, so it's pretty huge (almost 1GiB). Have uploaded to Google Drive: https://drive.google.com/file/d/1l_1RCDXdASSjWa4ePwZFmIiMaq9pYW4x

yota9 commented 1 month ago

Hello! Sorry for (very) long reply :) May I ask you if the llvm-bolt input -o output cmd fails too? It is probably duplicates the problem here https://github.com/llvm/llvm-project/issues/100920