[llvm-commits] gc-5-shadowstack.patch [5 of 6]

Gordon Henriksen gordonhenriksen at mac.com
Mon Sep 3 23:37:52 PDT 2007


• gc-5-shadowstack.patch (+59, -406 lines)
With this patch, the LowerGC transformation is adapted to become the  
ShadowStackCollector.

$ llvm-as < simple_ocaml.ll | llc -gc=shadow-stack


         .text
         .align  4,0x90
         .globl  _fun
_fun:
         subl    $44, %esp
         movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
         movl    (%eax), %ecx
         movl    %ecx, 16(%esp)
         movl    $2, 20(%esp)
         movl    $0, 28(%esp)
         movl    $0, 24(%esp)
         movl    $0, 12(%esp)
         leal    12(%esp), %ecx
         movl    %ecx, 24(%esp)
         movl    $0, 36(%esp)
         movl    $0, 32(%esp)
         leal    16(%esp), %ecx
         movl    %ecx, (%eax)
         movl    $0, 8(%esp)
         leal    8(%esp), %eax
         movl    %eax, 32(%esp)
         movl    48(%esp), %eax
         movl    %eax, 12(%esp)
LBB1_1: # bb.loop
         movl    12(%esp), %eax
         movl    4(%eax), %eax
         testl   %eax, %eax
         je      LBB1_1  # bb.loop
LBB1_2: # bb.end
         movl    $8, (%esp)
         call    L_malloc$stub
         movl    12(%esp), %ecx
         movl    %ecx, 4(%ecx)
         movl    L_llvm_gc_root_chain$non_lazy_ptr, %ecx
         movl    16(%esp), %edx
         movl    %edx, (%ecx)
         addl    $44, %esp
         ret
         .data
         .comm   _llvm_gc_root_chain,4           # llvm_gc_root_chain
.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code 
+pure_instructions,5
L_malloc$stub:
         .indirect_symbol _malloc
         hlt ; hlt ; hlt ; hlt ; hlt

.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_llvm_gc_root_chain$non_lazy_ptr:
         .indirect_symbol _llvm_gc_root_chain
         .long   0
         .subsections_via_symbols

— Gordon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070904/a4c08798/attachment.html>


More information about the llvm-commits mailing list