[llvm-dev] Continuing: How to write a custom LTO pass?

Oliver Braunsdorf via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 4 05:40:27 PDT 2017


Hi there,

Can someone please outline the steps to load a custom LTO pass at link time?

I wrote a module pass which currently runs under opt to analyze bitcode
files that have been manually linked using llvm-link.
[Working with LLVM3.8.0]

Now I want to integrate my custom pass into the a projects build chain.
I installed gold linker and built LLVMgold.so so that I can use the
"clang++ -flto" command to compile and link the project with LLVMs LTO
Passes(at least I believe that the LLVMs LTO passes are executed). I am
looking for some further command line option for clang to load the
shared library of my custom module pass.
Further I need to pass specific command line options to my module pass
itself.

As I read in the thread from 2015
(http://lists.llvm.org/pipermail/llvm-dev/2015-May/085744.html) I have
to modify files in llvm/tools/LTO or in llvm/lib/LTO to accomplish this.
Is that still true? Can someone please give me more detailed
instructions? Because the old thread is missing a lot of details and I
cannot find information in the LLVM documentation.

Thanks,
Oliver


More information about the llvm-dev mailing list