[LLVMdev] Re:Re:Is there any way to modify basic block like adding junk code
Zhang Qiuyu
qiuyu at ee.ucla.edu
Tue Sep 21 14:25:32 PDT 2004
Thanks Chris.
I did inserting function into code before using the way you mentioned, such as call a external function. But coud I insert some assemble instructions into *.bc ?
what I want to do is to implement polymorphic engine like ADM. It can change the binary code which looks like different but the functionality is exactly same. The simple way to do it is to add some junk code like NOP( 0x90) or dead code. But it is easy to identify the different binary codes by the above way which have same functionality. So there are some other ways to do it, however these are a little difficult. For example, after you analyse the a bunch of codes in one BB, if there are some independent code, we can shuffle those codes which will change the final binary code and keep same functionality.Or we can find some alternative codes to replace it......
Does llvm have the option for these?
Thanks.
> On Mon, 20 Sep 2004, Zhang Qiuyu wrote:
>
> > Is there any way to modify code like adding junk code or mess up the
> > order of a bunch of codes(in same basic block) which is no dependency? I
> > saw some options like -dce -deadargelim for 'opt' , but what I want is
> > to reverse to do it. I mean adding some dead code or junk code. Actually
> > what I want is to implement a ploymorphic engine. Coud I do those by
> > using llvm?
>
> Sure, modifying and adding to the LLVM IR is easy. Please read the
> programmers manual for more info:
>
> http://llvm.org/docs/ProgrammersManual.html
>
> For example, "Creating and inserting new Instructions" might be useful:
> http://llvm.org/docs/ProgrammersManual.html#schanges_creating
>
More information about the llvm-dev
mailing list