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:

  1. (without modify existing llvm source tree): add pass's source adding cmakelists.txt mentioned in link
  2. directly copy pass source code folder <llvm root>/lib/transform directory. , modify <llvm root>/lib/transform/cmakelists.txt, add add_subdirectory(<pass name>) line others.

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -