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
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?