Open
Description
Tested as of db1a762, the last worked was with llvm-17
Repro:
$ export LDFLAGS="-Wl,-O1 -Wl,-z,relro -Wl,-z,now -Wl,-z,max-page-size=0x1000 -Wl,-Bsymbolic-functions -Wl,--sort-common -Wl,-z,pack-relative-relocs -Wl,-q"
$ cmake -G Ninja -B stage1 -S llvm -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib64/ccache/bin/clang -DCMAKE_CXX_COMPILER=/usr/lib64/ccache/bin/clang++ -DCMAKE_ASM_COMPILER=/usr/lib64/ccache/bin/clang -DLLVM_ENABLE_PROJECTS="clang;lld;bolt" -DLLVM_ENABLE_RUNTIMES="compiler-rt" -DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCMAKE_INSTALL_PREFIX=stage1/install -DLLVM_LINK_LLVM_DYLIB=ON -DCLANG_LINK_CLANG_DYLIB=ON
$ ninja -C stage1 install
$ ./stage1/install/bin/llvm-bolt -instrument ./stage1/install/bin/../lib/libclang-cpp.so.20.0git -o ./stage1/install/bin/../lib/libclang-cpp.so.20.0git.instr
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: db1a76206902e6926464e30cc47249e217405dab
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0x4200000, offset 0x4200000
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: enabling lite mode
BOLT-WARNING: Failed to analyze 16 relocations
BOLT-WARNING: 6 collisions detected while hashing binary objects. Use -v=1 to see the list.
BOLT-INFO: 0 out of 112356 functions in the binary (0.0%) have non-empty execution profile
BOLT-INSTRUMENTER: Number of indirect call site descriptors: 39341
BOLT-INSTRUMENTER: Number of indirect call target descriptors: 110954
BOLT-INSTRUMENTER: Number of function descriptors: 110954
BOLT-INSTRUMENTER: Number of branch counters: 1350926
BOLT-INSTRUMENTER: Number of ST leaf node counters: 656205
BOLT-INSTRUMENTER: Number of direct call counters: 0
BOLT-INSTRUMENTER: Total number of counters: 2007131
BOLT-INSTRUMENTER: Total size of counters: 16057048 bytes (static alloc memory)
BOLT-INSTRUMENTER: Total size of string table emitted: 16615228 bytes in file
BOLT-INSTRUMENTER: Total size of descriptors: 133046532 bytes in file
BOLT-INSTRUMENTER: Profile will be saved to file /tmp/prof.fdata
BOLT-INFO: 550535 instructions were shortened
BOLT-INFO: removed 4300 empty blocks
BOLT-INFO: UCE removed 80769 blocks and 4856578 bytes of code
BOLT-INFO: padding code to 0xac00000 to accommodate hot text
BOLT-INFO: output linked against instrumentation runtime library, lib entry point is 0xc93a7a0
BOLT-INFO: clear procedure is 0xc936340
BOLT-INFO: patched build-id (flipped last bit)
BOLT-INFO: setting __bolt_runtime_start to 0xc93a760
BOLT-INFO: setting __bolt_runtime_fini to 0xc93a7a0
BOLT-INFO: setting __hot_start to 0x4400000
BOLT-INFO: setting __hot_end to 0xab075d7
$ mv ./stage1/install/bin/../lib/libclang-cpp.so.20.0git.instr ./stage1/install/bin/../lib/libclang-cpp.so.20.0git
$ ./stage1/install/bin/clang -v
Segmentation fault (core dumped)
backstrace
Stack trace of thread 307074:
#0 0x00007fb7b7fd7043 elf_get_dynamic_info (ld-linux-x86-64.so.2 + 0x7043)
#1 0x00007fb7b7fd7fe1 _dl_map_object (ld-linux-x86-64.so.2 + 0x7fe1)
#2 0x00007fb7b7fd29b5 openaux (ld-linux-x86-64.so.2 + 0x29b5)
#3 0x00007fb7b7fd14dd __GI__dl_catch_exception (ld-linux-x86-64.so.2 + 0x14dd)
#4 0x00007fb7b7fd2d14 _dl_map_object_deps (ld-linux-x86-64.so.2 + 0x2d14)
#5 0x00007fb7b7ff2a7f dl_main (ld-linux-x86-64.so.2 + 0x22a7f)
#6 0x00007fb7b7fef343 _dl_sysdep_start (ld-linux-x86-64.so.2 + 0x1f343)
#7 0x00007fb7b7ff0c7e _dl_start_final (ld-linux-x86-64.so.2 + 0x20c7e)
#8 0x00007fb7b7fef988 _start (ld-linux-x86-64.so.2 + 0x1f988)
ELF object binary architecture: AMD x86-64
Lemme know if I can provide any more details.