[LLVMdev] RE:RE: Question about inserting instructions

Qiuyu Zhang qiuyu at ucla.edu
Wed May 11 19:32:42 PDT 2005


Hi,

Thanks again.

>>> during step 2, we read *.bc code and find dummy BB and put some
>>> meaningless machinecode, here, we cannot put some illegal machince
>>> code, otherwise, step 3 goes to fail.
>>
>> Yes, you are correct -- if you want to create illegal code you need to
>> not use system as.  What you need is the ability for llc to create
>> object files with native code directly, without using the system
>> assembler.  I think someone is working on it, but I'm not sure as to the
>> status.  Otherwise, you will just have some random one-byte
>> instructions.
>
>Actually that's not true.  You can make instructions with an asmstring of:
>
>   ".byte 123\n .byte 56\n .byte 86" and those bytes will get emitted to 
>the code stream.

Yes, you are right. The way is like buffer overflow code in which the instructions exist as asm string in memory
\x123\x35\86......However, I have no idea how to make it . Would you like giving me idea? Is there any way I can follow?

CodeEmitGen.cpp MachineCodeEmitter.cpp ... which one is response for it? 

Thanks.
Qiuyu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050511/58e3855b/attachment.html>


More information about the llvm-dev mailing list