facebookarchive / BOLT

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

Binary optimization for dynamically loaded library from executable? #279

Closed wonjeon closed 2 years ago

wonjeon commented 2 years ago

Hello. I have a question for you. Does BOLT work for an executable with dynamically loading library? Is any special profiling technique needed for perf and BOLT? Thanks in advance.

maksfb commented 2 years ago

You have to separately optimize the executable and its dependencies, i.e. one at a time. The profile can be shared though. E.g.:


$ perf record -e cycles -j any,u -- ./a.out
$ llvm-bolt -p perf.data a.out -o a.out.bolt <bolt-options>
$ llvm-bolt -p perf.data liba.so -o liba.bolt.so <bolt-options>
$ mv liba.so liba.old.so && mv lib.bolt.so lib.so
wonjeon commented 2 years ago

Thanks. Will close this issue.