Run LLVM pass with opt

送分小仙女□ 提交于 2019-12-06 01:13:01

First you add in your pass :

static RegisterPass<StackProtector> X("StackProtector", "Insert stack protectors", false, false);

Second, in the terminal when you run the pass on a target file, after you run make, you have something like:

//home/YOURNAME/llvm/Release+Asserts/bin/opt -load //home/YOURNAME/llvm/Release+Asserts/lib/StackProtector.so -StackProtector //home/YOURNAME/llvm/tools/clang/woRKSPACE/Test.bc

where Test.bc is your target code. Also, be aware: in your Makefile, don't forget to add LIBRARYNAME = StackProtector.

Also, be aware if the pass in not already registered (if so, you will get a segfault error)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!