[LLVMdev] Question about SimplifyXorInst

Bill Wendling wendling at apple.com
Tue Jul 26 04:08:40 PDT 2011


On Jul 20, 2011, at 6:24 AM, Xueying ZHANG wrote:

> Hi all,
> 
> I am master student in Edinburgh, UK. I am doing my MSc project with  
> LLVM compiler and I have to modify LLVM to implement the StackGuard  
> with a XOR random Canary. However, I am not familiar with LLVM.
> 
> My problem is that I want to XOR the random canary word with the  
> return address which are both 32 bits. I found a method called  
> SimplifyXorInst(Value *, Value *, const TargetData *,const  
> DominatorTree *, unsigned) but I do not know whether it is right  
> method and how to use it. Could you give me some advice or sample code  
> about it?
> 
Hi Ying,

Like John said, it sounds like you want to modify the stack protector code. Look at this file:

	lib/CodeGen/StackProtector.cpp

and see if it could help you out. The SimplifyXorInst function is part of the "Instruction Combine" pass, which is an optimization pass. I doubt that it's the correct place to do what you're suggesting doing.

-bw





More information about the llvm-dev mailing list