[LLVMdev] A question about LLVM and x86 instruction mapping

Wei Zhang wei.wisc at gmail.com
Wed Jun 20 09:00:20 PDT 2012


Hello,

I have a question about mapping between LLVM IR and the generated binary's
instruction. Is there an easy way to map an LLVM instruction to a (or
group of) x86 instructions spit by LLVM code generation. More
specifically,

I am trying to harden some pointer dereference(against the null ptr
dereference). I have done some analysis around some pointer dereferences
at the LLVM level and inject LLVM IR code to harden them. Also I used
llvm-g++ to link my hardened LLVM bit code with libraries to generate a
x86 binary.

Once a seg fault occurs, in my segfault handler, I will look up the binary
PC(program counter) and see if this is something that has been hardened by
me, if so, I have some mechanism to recover this failure.

So here is a problem, I don't have the mapping information between my LLVM
IR and x86 instructions. I feel if it is supported by the LLVM
infrastructure, that will be great. Could you let me know if such
information is available? If not, could you make some suggestions how to
retrieve such information easily?

Thank you very much!

Wei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120620/c1d5da9b/attachment.html>


More information about the llvm-dev mailing list