facebookarchive / BOLT

Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries
2.51k stars 176 forks source link

Assertion failure #37

Open wutzi15 opened 6 years ago

wutzi15 commented 6 years ago

I've build BOLT following the instruction, recorded a perf profile and converted it. Now I'm trying to use it in llvm-bolt llvm-bolt <executable> -o <executable>.bolt -data=perf.fdata and it fails with the following message:

llvm-bolt: /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:323: void llvm::RuntimeDyldELF::resolveX86_64Relocation(const llvm::SectionEntry&, uint64_t, uint64_t, uint32_t, int64_t, uint64_t): Assertion 'isInt<32>(RealOffset)' failed.

`#0 0x00000000023c7c86 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/whep/src/llvm/lib/Support/Unix/Signals.inc:398:0

1 0x00000000023c7d19 PrintStackTraceSignalHandler(void*) /home/whep/src/llvm/lib/Support/Unix/Signals.inc:462:0

2 0x00000000023c61be llvm::sys::RunSignalHandlers() /home/whep/src/llvm/lib/Support/Signals.cpp:49:0

3 0x00000000023c75fb SignalHandler(int) /home/whep/src/llvm/lib/Support/Unix/Signals.inc:252:0

4 0x00007ffff7bce6d0 __restore_rt (/lib64/libpthread.so.0+0xf6d0)

5 0x00007ffff67bd277 __GI_raise (/lib64/libc.so.6+0x36277)

6 0x00007ffff67be968 __GI_abort (/lib64/libc.so.6+0x37968)

7 0x00007ffff67b6096 __assert_fail_base (/lib64/libc.so.6+0x2f096)

8 0x00007ffff67b6142 (/lib64/libc.so.6+0x2f142)

9 0x00000000030b33c7 llvm::RuntimeDyldELF::resolveX86_64Relocation(llvm::SectionEntry const&, unsigned long, unsigned long, unsigned int, long, unsigned long) /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:324:0

10 0x00000000030b63e0 llvm::RuntimeDyldELF::resolveRelocation(llvm::SectionEntry const&, unsigned long, unsigned long, unsigned int, long, unsigned long, unsigned int) /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:976:0

11 0x00000000030b6357 llvm::RuntimeDyldELF::resolveRelocation(llvm::RelocationEntry const&, unsigned long) /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:966:0

12 0x000000000308f211 llvm::RuntimeDyldImpl::resolveRelocationList(llvm::SmallVector<llvm::RelocationEntry, 64u> const&, unsigned long) /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:1006:0

13 0x000000000308fa8b llvm::RuntimeDyldImpl::resolveExternalSymbols() /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:1102:0

14 0x000000000308a387 llvm::RuntimeDyldImpl::resolveRelocations() /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:131:0

15 0x0000000003090216 llvm::RuntimeDyld::resolveRelocations() /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:1220:0

16 0x0000000003090337 llvm::RuntimeDyld::finalizeWithMemoryManagerLocking() /home/whep/src/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:1244:0

17 0x00000000005f2033 llvm::orc::RTDyldObjectLinkingLayer::ConcreteLinkedObject<std::shared_ptr >::finalize() /home/whep/src/llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h:150:0

18 0x00000000005939a9 llvm::orc::RTDyldObjectLinkingLayer::emitAndFinalize(unsigned long) /home/whep/src/llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h:350:0

19 0x000000000057fcd2 llvm::bolt::RewriteInstance::emitFunctions() /home/whep/src/llvm/tools/llvm-bolt/src/RewriteInstance.cpp:2958:0

20 0x00000000005716af operator() /home/whep/src/llvm/tools/llvm-bolt/src/RewriteInstance.cpp:1006:0

21 0x00000000005716af llvm::bolt::RewriteInstance::run()::'lambda'(std::set<unsigned long, std::less, std::allocator > const&)::operator()(std::set<unsigned long, std::less, std::allocator > const&) const (../build_llvm/bin/llvm-bolt+0x5716af)

22 0x00000000005717e2 llvm::bolt::RewriteInstance::run() /home/whep/src/llvm/tools/llvm-bolt/src/RewriteInstance.cpp:1015:0

23 0x0000000000411bdb main /home/whep/src/llvm/tools/llvm-bolt/src/llvm-bolt.cpp:269:0

24 0x00007ffff67a9445 __libc_start_main (/lib64/libc.so.6+0x22445)

25 0x0000000000410895 _start (../build_llvm/bin/llvm-bolt+0x410895)`

maksfb commented 6 years ago

Is there any way you can share the binary you are running on? It's hard to tell what's going on, as the error is happening pretty late in the pipeline.

wutzi15 commented 6 years ago

sure. I've attached a zip of the elf. SherpaStat.zip I'm also getting this now:

perf2bolt: /llvm/tools/llvm-bolt/src/RewriteInstance.cpp:1959: bool llvm::bolt::RewriteInstance::analyzeRelocation(const llvm::object::RelocationRef&, llvm::object::SectionRef, std::__cxx11::string&, uint64_t&, int64_t&, uint64_t&) const: Assertion verifyExtractedValue() && "mismatched extracted relocation value"' failed.

maksfb commented 6 years ago

Sorry for the delay in response. That's a very interesting looking binary. It has many loadable segments at high addresses, and an entry point outside of any marked section, besides other peculiarities. It also appears to be stripped of most symbols. May I ask how you generated the binary?

wutzi15 commented 5 years ago

Sorry for the delay. Well this is a binary for the Sherpa Monto Carlo Generator ( https://sherpa.hepforge.org/trac/wiki) and I build it using the default sets of autotool, if that is what you mean.