[LLVMdev] statically link pass to clang

NAKAMURA Takumi geek4civic at gmail.com
Sun Sep 25 20:45:57 PDT 2011

2011/9/24 Zeng Bin <ezengbin at gmail.com>:
> A question about statically linking a pass to clang instead of dynamically
> loading it at runtime. I am stumped on this bug for a while. I inserted a
> pass under lib/Transforms/mypass directory, registered it with
> INITIALIZE_PASS and defined createMyPass in the pass. Also I added file
> mypass.h in include/llvm/Transforms/ to expose the accessor functions that
> expose my passes. Entries are added in include/llvm/LinkAllPasses.h to force
> pass linking. The archive files of my passes are added to LINK_COMPONENTS in
> the Makefiles for opt and clang. However, the passes are still not
> statically linked. Is there a way to statically link a pass into clang? If
> possible, how do turn on and off my passes with command line options?

I don't think include/llvm/LinkAllPasses.h would affect clang.
Did you see lib/Transforms/IPO/PassManagerBuilder.cpp ?


More information about the llvm-dev mailing list