| Issue |
170722
|
| Summary |
[BOLT] libbolt_* fail to search for libraries with symbolic link executable in LLVM <= 19.
|
| Labels |
BOLT
|
| Assignees |
|
| Reporter |
cyyself
|
For BOLT in LLVM <= 19, it only searches libraries from `argv[0]/../../lib` [(RuntimeLibrary.cpp#L34)](https://github.com/llvm/llvm-project/blob/cd708029e0b2869e80abe31ddb175f7c35361f90/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp#L34), resulting in directly using `llvm-bolt --instrument` from a symbolic link like `/usr/bin/llvm-bolt` fails to find the `libbolt_rt_instr.a`. A workaround in real-world scripts can replace `llvm-bolt` with `readlink -f $(command -v llvm-bolt)`.
This has been mitigated since #97130 with LLVM-20 and resolved since #126386. But some Distros like Debian or Ubuntu still use LLVM-18 or LLVM-19, thus **should be backported**.
Steps to reproduce such an issue:
```bash
#!/usr/bin/env bash
echo "int main() { return 0; }" > /tmp/test.cpp && \
clang++ /tmp/test.cpp -o /tmp/test -Wl,--emit-relocs && \
llvm-bolt /tmp/test --instrument -o /tmp/test-instr
```
Related Debian Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121914
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs