Issue 54225
Summary LLVM instrumented with BOLT segfaults
Labels new issue
Assignees
Reporter Kobzol
    Hi! I'm trying to use BOLT on LLVM itself to try to speed up the `rustc` compiler (https://github.com/rust-lang/rust/pull/94381).

When I instrument the LLVM library (built with `LLVM_BUILD_LLVM_DYLIB=ON`) and the `rustc` compiler later uses that instrumented library, it sometimes segfaults (https://github.com/rust-lang-ci/rust/runs/5425308791?check_suite_focus=true).

This is the output I get when instrumenting BOLT:
<details>
<summary>BOLT log</summary>

```
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: <unknown>
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0x5a00000, offset 0x5a00000
BOLT-INFO: enabling relocation mode
BOLT-INFO: forcing -jump-tables=move for instrumentation
BOLT-INFO: enabling -align-macro-fusion=all since no profile was specified
BOLT-INFO: enabling lite mode
BOLT-WARNING: Failed to analyze 5229 relocations
BOLT-WARNING: Ignored 0 functions due to cold fragments.
BOLT-WARNING: 19 collisions detected while hashing binary objects. Use -v=1 to see the list.
BOLT-INSTRUMENTER: Number of indirect call site descriptors: 68972
BOLT-INSTRUMENTER: Number of indirect call target descriptors: 74099
BOLT-INSTRUMENTER: Number of function descriptors: 74099
BOLT-INSTRUMENTER: Number of branch counters: 1523333
BOLT-INSTRUMENTER: Number of ST leaf node counters: 602638
BOLT-INSTRUMENTER: Number of direct call counters: 4969
BOLT-INSTRUMENTER: Total number of counters: 2130940
BOLT-INSTRUMENTER: Total size of counters: 17047520 bytes (static alloc memory)
BOLT-INSTRUMENTER: Total size of string table emitted: 6995854 bytes in file
BOLT-INSTRUMENTER: Total size of descriptors: 128931880 bytes in file
BOLT-INSTRUMENTER: Profile will be saved to file /tmp/prof.fdata
BOLT-INFO: 0 out of 74859 functions in the binary (0.0%) have non-empty execution profile
BOLT-INFO: the input contains 15962 (dynamic count : 0) opportunities for macro-fusion optimization that are going to be fixed
BOLT-INFO: 4948511 instructions were shortened
BOLT-INFO: removed 10459 empty blocks
BOLT-INFO: merged 1 duplicate CFG edge
BOLT-INFO: removed 216 'repz' prefixes with estimated execution count of 0 times.
BOLT-INFO: UCE removed 65330 blocks and 4489397 bytes of code.
BOLT-INFO: SCTC: patched 0 tail calls (0 forward) tail calls (0 backward) from a total of 0 while removing 0 double jumps and removing 0 basic blocks totalling 0 bytes of code. CTCs total execution count is 0 and the number of times CTCs are taken is 0.
BOLT-INFO: output linked against instrumentation runtime library, lib entry point is 0xede32d0
BOLT-INFO: clear procedure is 0xede13a0
```
</details>

Is there something that looks out of place?

For instrumentation I use simply `llvm-bolt -instrument <LLVM lib> -o ...`. The LLVM lib is built with `-Wl,-q`. BOLT itself is built with LLVM version 14.0.0-rc1.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to