I’m trying to implement something similar to sandbox(Software fault isolation).I put the protect instruction
and danger instruction(such as call) in a basicblock and use the MachineBasicBlock::setAlignment to align it
to 32B.The results is the picture above.but i’m wondering if it’s possible to insert the no-op before the call
instruction like the picture below.
some protect instruction | call instruction | no-ops |
some protect instruction | no-ops | call instruction |
So is it possible to modify llvm’s X86 backend to set the layout like this?(I guess google’s native client achieve
this goal, but i can’t find any document.) I know there is no pass in MC layer, i just want to know if i modify
the source code, can i achieve this goal?
The second question, does function EmitNops in ‘llvm/lib/Target/X86/MCInstLower’ insert all no-ops to the binary?
if not, which function does?
Thanks for your help.