Issue 124157
Summary Instrumentation failing: Assertion `!StateStack.empty() && "corrupt CFI stack"' failed
Labels new issue
Assignees
Reporter estaban
    Bolt instrumentation is failing when trying to instrument a shared library.
- It works fine on x86_64
- The binary has been built with Rust 1.84.0 using `-C opt-level=3 -C lto -C codegen-units=1 -C debuginfo=2 -C metadata=9a450637e871382d -Ctarget-cpu=neoverse-n1 '-Clink-args=-Wl,--as-needed -pthread -g' -Clinker=/usr/bin/gcc -Crpath=y -Clink-arg=-Wl,--disable-new-dtags -Clink-arg=-Wl,-rpath,XXX/lib -Clink-args=-static-libgcc -Clink-args=-static-libstdc++ -Clink-arg=-Wl,--emit-relocs`

Failure:

```
$ ./build/bin/llvm-bolt libmybus_jni.so -instrument -o libmybus_jni.so
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: aarch64
BOLT-INFO: BOLT version: 0236cb689550ed2dac406443c652efb723cb2602
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0x600000, offset 0x600000
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-WARNING: ignoring symbol $d at 0x4ed6b0, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed678, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed668, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed658, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed648, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed638, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed628, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed618, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed608, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed5f8, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed5e8, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed5d8, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed5c8, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed5b8, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed5a8, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol $d at 0x4ed598, which lies outside .eh_frame
BOLT-WARNING: ignoring symbol __bss_start__ at 0x5c2e10, which lies outside .bss
BOLT-WARNING: ignoring symbol __bss_start at 0x5c2e10, which lies outside .bss
BOLT-WARNING: reference in the middle of instruction detected in function bignum_copy_row_from_table_32_neon/1 at offset 0xa0c0
llvm-bolt: /home/me/llvm/llvm-project/bolt/lib/Core/BinaryFunction.cpp:2491: void llvm::bolt::BinaryFunction::annotateCFIState(): Assertion `!StateStack.empty() && "corrupt CFI stack"' failed.
 #0 0x0000000000e4f9d0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (.localalias) (/home/me/llvm/build/bin/llvm-bolt+0xe4f9d0)
 #1 0x0000000000e4d434 SignalHandler(int) (/home/me/llvm/build/bin/llvm-bolt+0xe4d434)
 #2 0x0000ffffb5ca8834 (linux-vdso.so.1+0x834)
 #3 0x0000ffffb57c7834 raise (/lib64/libc.so.6+0x32834)
 #4 0x0000ffffb57c9140 abort (/lib64/libc.so.6+0x34140)
 #5 0x0000ffffb57c0780 __assert_fail_base (/lib64/libc.so.6+0x2b780)
 #6 0x0000ffffb57c07fc (/lib64/libc.so.6+0x2b7fc)
 #7 0x0000000001608094 llvm::bolt::BinaryFunction::annotateCFIState() (.localalias) (/home/me/llvm/build/bin/llvm-bolt+0x1608094)
 #8 0x000000000161f8fc llvm::bolt::BinaryFunction::buildCFG(unsigned short) (/home/me/llvm/build/bin/llvm-bolt+0x161f8fc)
 #9 0x0000000000ef1850 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&&) (/home/me/llvm/build/bin/llvm-bolt+0xef1850)
#10 0x000000000166ee34 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&) (/home/me/llvm/build/bin/llvm-bolt+0x166ee34)
#11 0x0000000000f36dc8 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<std::function<void ()> > >, void> >::_M_invoke(std::_Any_data const&) (/home/me/llvm/build/bin/llvm-bolt+0xf36dc8)
#12 0x0000000000f3770c std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/home/me/llvm/build/bin/llvm-bolt+0xf3770c)
#13 0x0000ffffb5c44c54 __pthread_once_slow (/lib64/libpthread.so.0+0xfc54)
#14 0x0000000000f37580 std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<std::function<void ()> > >, void>::_M_complete_async() (/home/me/llvm/build/bin/llvm-bolt+0xf37580)
#15 0x0000000000f3bdd0 std::_Function_handler<void (), std::shared_future<void> llvm::ThreadPoolInterface::asyncImpl<void>(std::function<void ()>, llvm::ThreadPoolTaskGroup*)::'lambda'()>::_M_invoke(std::_Any_data const&) (/home/me/llvm/build/bin/llvm-bolt+0xf3bdd0)
#16 0x000000000244a838 llvm::StdThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) (.localalias) (/home/me/llvm/build/bin/llvm-bolt+0x244a838)
#17 0x000000000244b484 void* llvm::thread::ThreadProxy<std::tuple<llvm::StdThreadPool::grow(int)::'lambda'()> >(void*) (/home/me/llvm/build/bin/llvm-bolt+0x244b484)
#18 0x0000ffffb5c3c230 start_thread (/lib64/libpthread.so.0+0x7230)
#19 0x0000ffffb58707dc thread_start (/lib64/libc.so.6+0xdb7dc)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Aborted
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to