[llvm-dev] LLVM IR from static/dynamic libraries

John Criswell via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 9 06:09:45 PDT 2015


On 10/8/15 11:20 PM, Vedant Kumar via llvm-dev wrote:
> Hi,
>
> Could you explain why you're trying to obfuscate libraries?
>
> At any rate if you're looking for a way to convert machine code into llvm IR, then I don't think there's a well-supported way of doing that.

There are at least two tools for converting machine code to LLVM IR.

One is RevGen (http://dslab.epfl.ch/pubs/revgen.pdf).

The other is BAP (http://users.ece.cmu.edu/~ejschwar/papers/cav11.pdf).

Both are open source though I'm not sure where to find them.  A Google 
search should fix that.

Please be aware that the LLVM IR generated by these tools is not quite 
like the LLVM IR generated by Clang when compiling from source to LLVM 
IR.  RevGen (and probably BAP) create code that emulates the processor 
on which the binary runs and then uses LLVM optimizations to try to 
clean up the result.  If you take the result and translate it back to 
machine code, it may not run very efficiently (if it runs at all; these 
tools are primarily designed to analyze binary code by reusing existing 
infrastructure in LLVM).

If you want to obfuscate existing binary code, there may be better 
methods.  For example, if I were to do it, I would use LLVM's MC layer 
to disassemble the code, maybe raise the code to the LLVM MachineInstr 
level, and then do analysis/obfuscation at that level. Raising all the 
way up to LLVM IR probably won't add much.

Regards,

John Criswell


>
> vedant
>
>> On Oct 6, 2015, at 10:53 PM, Sandeep Kumar Singh via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>
>> Hi All,
>>
>> Is this possible to generate LLVM IR from any static/dynamic link library?
>> I have some static and dynamic link library and I want to generate LLVM IR as I want to obfuscate these libraries.
>> Is there any way to do the same.
>>
>> Please give me some pointers on this.
>>
>> Thanks,
>> Deep
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell



More information about the llvm-dev mailing list