[llvm-dev] Modify how llvm backend aligned

Sam Elliott via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 20 15:53:39 PDT 2020


You want to look for uses of the `MCBoundaryAlignFragment` class in the X86AsmBackend. This should provide some hints for how to insert alignment-specific fragments.

Sam

> On 10 Aug 2020, at 11:36 am, 郑晗 via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi:
>     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.
>     0B                                                                              32B
>     | 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.
>     Regards,
>     zheng han
>  <alignment.png>_______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

--
Sam Elliott
Software Team Lead
Senior Software Developer - LLVM and OpenTitan
lowRISC CIC

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


More information about the llvm-dev mailing list