<div>Hi Duncan,</div><div><br></div><div>I mean both. In order to generate random code, I have to add function definitions and also for robustness I have to call these functions from already existing functions. So, have to add calling type of instructions also in the existing function. </div>
<div>In future I also have to change instructions for simple substitution meaning</div><div><br></div><div>'add a, b' can be done using  'sub a, 0' and followed by 'add a, b' or something like that. So, have to modify / add instructions in the existing code.  </div>
<div><br></div><div>I am not much aware of LLVM IR Linker (llvm-ld). I know that it takes multiple bitcode files and then link them together to generate one bitcode file. Is it possible to add functions and instructions using this tool ?</div>
<div><br></div><div><br></div><div>Thanks,</div><div>Teja</div><div><br></div><div><br></div><br><br><div class="gmail_quote">
On Mon, Nov 19, 2012 at 12:20 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Teja,<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am working on my Master's project in security and for this I need to do<br>
following things :<br>
<br>
1. I have a IR bytecode of the main program. I want to insert dead code from<br>
other source files (e.g. cygwin files or the Linux files) in main program's IR<br>
byte code.<br>
</blockquote>
<br></div>
do you mean adding additional functions?  Or do you mean adding extra<br>
instructions to existing functions?  In the first case why not use the<br>
LLVM IR linker (llvm-link) to add in the extra bitcode?<br>
<br>
Ciao, Duncan.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2. In order to insert code, I can try following two ways :<br>
    (i) I have observed that these IR bytecode files are just like a text file<br>
and they have fixed format. Using file operations, we can modify IR byte code of<br>
the first file by inserting the IR byte code from other files.<br>
    (ii) Second approach is to use LLC Tool to generate c++ code of second IR<br>
byte code. Then use generated c++ code and insert into the first IR byte code.<br>
Write the optimizer pass on first IR byte code and add the instructions from<br>
generated c++ code. Get the modified IR bytecode of the first program.<br>
<br>
Which approach is better and are there any other ways which I can use?<br>
</blockquote>
<br>
<br>
<br></div>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Teja<br>