llvm - How to change LLVMPass long opt command to a simple Command -
i working on llvm obfuscation project. have written llvm pass(lets flow flattening pass) running on source (test.c) following command:
clang -emit-llvm test.c -c -o test.bc opt -load ../../.. llvmflattening.so -fla <test.bc>/dev/null but have seen in o-llvm project achieved same thing using:
clang -emit-llvm test.c -c -o test.bc -mllvm -fla can tell me -mllvm here , how changed simple command?
-mllvm means additional arguments forward llvm's option processing. therefore -mllvm -fla pass -fla llvm's option processing.
clang , llvm run seperately. if want clang run llvm, , have options want llvm aware. -mllvm need.
defautly, llvm not turn on transformation passes. -fla, llvm turn on pass registered command line argument fla call function registerpass<typename passname>.
in command line, opt's -load option used load plugin. if want use simple command line expect. pass need linked opt binary. done in following 2 ways:
- (without modify existing llvm source tree): add pass's source adding
cmakelists.txtmentioned in link - directly copy pass source code folder
<llvm root>/lib/transformdirectory. , modify<llvm root>/lib/transform/cmakelists.txt, addadd_subdirectory(<pass name>)line others.
Comments
Post a Comment