add unwind infor for *go_closure;
authorfoxsen <2503799872@qq.com>
Thu, 20 Aug 2015 12:28:13 +0000 (20:28 +0800)
committerfoxsen <2503799872@qq.com>
Thu, 20 Aug 2015 12:28:13 +0000 (20:28 +0800)
reorder the labels to make thing more clear

src/mips/n32.S
src/mips/o32.S

index 750555e..63f79a9 100644 (file)
        .globl  ffi_call_N32
        .ent    ffi_call_N32
 ffi_call_N32:  
-.LFB3:
+.LFB0:
        .frame  $fp, SIZEOF_FRAME, ra
        .mask   0xc0000000,-FFI_SIZEOF_ARG
        .fmask  0x00000000,0
 
        # Prologue
        SUBU    $sp, SIZEOF_FRAME                       # Frame size
-.LCFI0:
+.LCFI00:
        REG_S   $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp)       # Save frame pointer
        REG_S   ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp)        # Save return address
-.LCFI1:
+.LCFI01:
        move    $fp, $sp
-.LCFI3:
+.LCFI02:
        move    t9, callback    # callback function pointer
        REG_S   bytes, 2*FFI_SIZEOF_ARG($fp) # bytes
        REG_S   flags, 3*FFI_SIZEOF_ARG($fp) # flags
@@ -354,7 +354,7 @@ epilogue:
        ADDU    $sp, SIZEOF_FRAME                     # Fix stack pointer
        j       ra
 
-.LFE3:
+.LFE0:
        .end    ffi_call_N32
 
 /* ffi_closure_N32. Expects address of the passed-in ffi_closure in t0
@@ -417,13 +417,15 @@ epilogue:
        .globl  ffi_go_closure_N32
        .ent    ffi_go_closure_N32
 ffi_go_closure_N32:
+.LFB1:
        .frame  $sp, SIZEOF_FRAME2, ra
        .mask   0x90000000,-(SIZEOF_FRAME2 - RA_OFF2)
        .fmask  0x00000000,0
        SUBU    $sp, SIZEOF_FRAME2
-
+.LCFI10:
        .cpsetup t9, GP_OFF2, ffi_go_closure_N32
        REG_S   ra, RA_OFF2($sp)        # Save return address
+.LCFI11:
 
        REG_S   a0, A0_OFF2($sp)
        REG_S   a1, A1_OFF2($sp)
@@ -443,6 +445,7 @@ ffi_go_closure_N32:
 
        b       $do_closure
 
+.LFE1: 
        .end    ffi_go_closure_N32
 
        .align  2
@@ -454,10 +457,10 @@ ffi_closure_N32:
        .mask   0x90000000,-(SIZEOF_FRAME2 - RA_OFF2)
        .fmask  0x00000000,0
        SUBU    $sp, SIZEOF_FRAME2
-.LCFI5:
+.LCFI20:
        .cpsetup t9, GP_OFF2, ffi_closure_N32
        REG_S   ra, RA_OFF2($sp)        # Save return address
-.LCFI6:
+.LCFI21:
        REG_S   a0, A0_OFF2($sp)
        REG_S   a1, A1_OFF2($sp)
        REG_S   a2, A2_OFF2($sp)
@@ -576,46 +579,66 @@ cls_epilogue:
         .align  EH_FRAME_ALIGN
 .LECIE1:
 
-.LSFDE1:
-        .4byte  .LEFDE1-.LASFDE1       # length.
-.LASFDE1:
-        .4byte  .LASFDE1-.Lframe1      # CIE_pointer.
-        FDE_ADDR_BYTES  .LFB3          # initial_location.
-        FDE_ADDR_BYTES  .LFE3-.LFB3    # address_range.
+.LSFDE0:
+        .4byte  .LEFDE0-.LASFDE0       # length.
+.LASFDE0:
+        .4byte  .LASFDE0-.Lframe1      # CIE_pointer.
+        FDE_ADDR_BYTES  .LFB0          # initial_location.
+        FDE_ADDR_BYTES  .LFE0-.LFB0    # address_range.
         .byte   0x4                    # DW_CFA_advance_loc4
-        .4byte  .LCFI0-.LFB3           # to .LCFI0
+        .4byte  .LCFI00-.LFB0          # to .LCFI00
         .byte   0xe                    # DW_CFA_def_cfa_offset
         .uleb128 SIZEOF_FRAME          # adjust stack.by SIZEOF_FRAME
         .byte   0x4                    # DW_CFA_advance_loc4
-        .4byte  .LCFI1-.LCFI0          # to .LCFI1
+        .4byte  .LCFI01-.LCFI00                # to .LCFI01
         .byte   0x9e                   # DW_CFA_offset of $fp
         .uleb128 2*FFI_SIZEOF_ARG/4    # 
         .byte   0x9f                   # DW_CFA_offset of ra
         .uleb128 1*FFI_SIZEOF_ARG/4    # 
         .byte   0x4                    # DW_CFA_advance_loc4
-        .4byte  .LCFI3-.LCFI1          # to .LCFI3
+        .4byte  .LCFI02-.LCFI01                # to .LCFI02
         .byte   0xd                    # DW_CFA_def_cfa_register
         .uleb128 0x1e                  # in $fp
         .align  EH_FRAME_ALIGN
+.LEFDE0:
+
+.LSFDE1:
+       .4byte  .LEFDE1-.LASFDE1        # length
+.LASFDE1:
+       .4byte  .LASFDE1-.Lframe1       # CIE_pointer.
+       FDE_ADDR_BYTES  .LFB1           # initial_location.
+       FDE_ADDR_BYTES  .LFE1-.LFB1     # address_range.
+       .byte   0x4                     # DW_CFA_advance_loc4
+       .4byte  .LCFI10-.LFB2           # to .LCFI10
+       .byte   0xe                     # DW_CFA_def_cfa_offset
+       .uleb128 SIZEOF_FRAME2          # adjust stack.by SIZEOF_FRAME
+       .byte   0x4                     # DW_CFA_advance_loc4
+       .4byte  .LCFI11-.LCFI10         # to .LCFI11
+       .byte   0x9c                    # DW_CFA_offset of $gp ($28)
+       .uleb128 (SIZEOF_FRAME2 - GP_OFF2)/4
+       .byte   0x9f                    # DW_CFA_offset of ra ($31)
+       .uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4
+       .align  EH_FRAME_ALIGN
 .LEFDE1:
-.LSFDE3:
-       .4byte  .LEFDE3-.LASFDE3        # length
-.LASFDE3:
-       .4byte  .LASFDE3-.Lframe1       # CIE_pointer.
+
+.LSFDE2:
+       .4byte  .LEFDE2-.LASFDE2        # length
+.LASFDE2:
+       .4byte  .LASFDE2-.Lframe1       # CIE_pointer.
        FDE_ADDR_BYTES  .LFB2           # initial_location.
        FDE_ADDR_BYTES  .LFE2-.LFB2     # address_range.
        .byte   0x4                     # DW_CFA_advance_loc4
-       .4byte  .LCFI5-.LFB2            # to .LCFI5
+       .4byte  .LCFI20-.LFB2           # to .LCFI20
        .byte   0xe                     # DW_CFA_def_cfa_offset
        .uleb128 SIZEOF_FRAME2          # adjust stack.by SIZEOF_FRAME
        .byte   0x4                     # DW_CFA_advance_loc4
-       .4byte  .LCFI6-.LCFI5           # to .LCFI6
+       .4byte  .LCFI21-.LCFI20         # to .LCFI21
        .byte   0x9c                    # DW_CFA_offset of $gp ($28)
        .uleb128 (SIZEOF_FRAME2 - GP_OFF2)/4
        .byte   0x9f                    # DW_CFA_offset of ra ($31)
        .uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4
        .align  EH_FRAME_ALIGN
-.LEFDE3:
+.LEFDE2:
 #endif /* __GNUC__ */  
        
 #endif
index 8ec6649..69324e6 100644 (file)
@@ -50,14 +50,14 @@ ffi_call_O32:
 $LFB0:
        # Prologue
        SUBU    $sp, SIZEOF_FRAME       # Frame size
-$LCFI0:
+$LCFI00:
        REG_S   $fp, FP_OFF($sp)        # Save frame pointer
-$LCFI1:
+$LCFI01:
        REG_S   ra, RA_OFF($sp)         # Save return address
-$LCFI2:
+$LCFI02:
        move    $fp, $sp
 
-$LCFI3:
+$LCFI03:
        move    t9, callback            # callback function pointer
        REG_S   flags, A3_OFF($fp)      # flags
 
@@ -239,6 +239,7 @@ $LFE0:
        .globl  ffi_go_closure_O32
        .ent    ffi_go_closure_O32
 ffi_go_closure_O32:
+$LFB1:
        # Prologue
        .frame  $fp, SIZEOF_FRAME2, ra
        .set    noreorder
@@ -246,12 +247,15 @@ ffi_go_closure_O32:
        .set    reorder
        SUBU    $sp, SIZEOF_FRAME2
        .cprestore GP_OFF2
+$LCFI10:
 
        REG_S   $16, S0_OFF2($sp)        # Save s0
        REG_S   $fp, FP_OFF2($sp)        # Save frame pointer
        REG_S   ra, RA_OFF2($sp)         # Save return address
+$LCFI11:
 
        move    $fp, $sp
+$LCFI12:
 
        REG_S   a0, A0_OFF2($fp)
        REG_S   a1, A1_OFF2($fp)
@@ -283,13 +287,14 @@ ffi_go_closure_O32:
 
        b $do_closure
 
+$LFE1:
        .end ffi_go_closure_O32
 
        .align  2
        .globl  ffi_closure_O32
        .ent    ffi_closure_O32
 ffi_closure_O32:
-$LFB1:
+$LFB2:
        # Prologue
        .frame  $fp, SIZEOF_FRAME2, ra
        .set    noreorder
@@ -297,14 +302,14 @@ $LFB1:
        .set    reorder
        SUBU    $sp, SIZEOF_FRAME2
        .cprestore GP_OFF2
-$LCFI4:
+$LCFI20:
        REG_S   $16, S0_OFF2($sp)        # Save s0
        REG_S   $fp, FP_OFF2($sp)        # Save frame pointer
        REG_S   ra, RA_OFF2($sp)         # Save return address
-$LCFI6:
+$LCFI21:
        move    $fp, $sp
 
-$LCFI7:
+$LCFI22:
        # Store all possible argument registers. If there are more than
        # four arguments, then they are stored above where we put a3.
        REG_S   a0, A0_OFF2($fp)
@@ -367,7 +372,7 @@ closure_done:
        REG_L   ra,  RA_OFF2($sp)        # Restore return address
        ADDU    $sp, SIZEOF_FRAME2
        j       ra
-$LFE1:
+$LFE2:
        .end    ffi_closure_O32
 
 /* DWARF-2 unwind info. */
@@ -389,6 +394,7 @@ $LSCIE0:
        .uleb128 0x0
        .align  2
 $LECIE0:
+
 $LSFDE0:
        .4byte  $LEFDE0-$LASFDE0         # FDE Length
 $LASFDE0:
@@ -397,11 +403,11 @@ $LASFDE0:
        .4byte  $LFE0-$LFB0      # FDE address range
        .uleb128 0x0     # Augmentation size
        .byte   0x4      # DW_CFA_advance_loc4
-       .4byte  $LCFI0-$LFB0
+       .4byte  $LCFI00-$LFB0
        .byte   0xe      # DW_CFA_def_cfa_offset
        .uleb128 0x18
        .byte   0x4      # DW_CFA_advance_loc4
-       .4byte  $LCFI2-$LCFI0
+       .4byte  $LCFI01-$LCFI00
        .byte   0x11     # DW_CFA_offset_extended_sf
        .uleb128 0x1e    # $fp
        .sleb128 -2      # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp)
@@ -409,12 +415,13 @@ $LASFDE0:
        .uleb128 0x1f    # $ra
        .sleb128 -1      # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp)
        .byte   0x4      # DW_CFA_advance_loc4
-       .4byte  $LCFI3-$LCFI2
+       .4byte  $LCFI02-$LCFI01
        .byte   0xc      # DW_CFA_def_cfa
        .uleb128 0x1e
        .uleb128 0x18
        .align  2
 $LEFDE0:
+
 $LSFDE1:
        .4byte  $LEFDE1-$LASFDE1         # FDE Length
 $LASFDE1:
@@ -423,11 +430,11 @@ $LASFDE1:
        .4byte  $LFE1-$LFB1      # FDE address range
        .uleb128 0x0     # Augmentation size
        .byte   0x4      # DW_CFA_advance_loc4
-       .4byte  $LCFI4-$LFB1
+       .4byte  $LCFI10-$LFB1
        .byte   0xe      # DW_CFA_def_cfa_offset
        .uleb128 SIZEOF_FRAME2
        .byte   0x4      # DW_CFA_advance_loc4
-       .4byte  $LCFI6-$LCFI4
+       .4byte  $LCFI11-$LCFI10
        .byte   0x11     # DW_CFA_offset_extended_sf
        .uleb128 0x10    # $16
        .sleb128 -3      # SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp)
@@ -438,11 +445,41 @@ $LASFDE1:
        .uleb128 0x1f    # $ra
        .sleb128 -1      # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp)
        .byte   0x4      # DW_CFA_advance_loc4
-       .4byte  $LCFI7-$LCFI6
+       .4byte  $LCFI12-$LCFI11
        .byte   0xc      # DW_CFA_def_cfa
        .uleb128 0x1e
        .uleb128 SIZEOF_FRAME2
        .align  2
 $LEFDE1:
 
+$LSFDE2:
+       .4byte  $LEFDE2-$LASFDE2         # FDE Length
+$LASFDE2:
+       .4byte  $LASFDE2-$Lframe0        # FDE CIE offset
+       .4byte  $LFB2    # FDE initial location
+       .4byte  $LFE2-$LFB2      # FDE address range
+       .uleb128 0x0     # Augmentation size
+       .byte   0x4      # DW_CFA_advance_loc4
+       .4byte  $LCFI20-$LFB2
+       .byte   0xe      # DW_CFA_def_cfa_offset
+       .uleb128 SIZEOF_FRAME2
+       .byte   0x4      # DW_CFA_advance_loc4
+       .4byte  $LCFI21-$LCFI20
+       .byte   0x11     # DW_CFA_offset_extended_sf
+       .uleb128 0x10    # $16
+       .sleb128 -3      # SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp)
+       .byte   0x11     # DW_CFA_offset_extended_sf
+       .uleb128 0x1e    # $fp
+       .sleb128 -2      # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp)
+       .byte   0x11     # DW_CFA_offset_extended_sf
+       .uleb128 0x1f    # $ra
+       .sleb128 -1      # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp)
+       .byte   0x4      # DW_CFA_advance_loc4
+       .4byte  $LCFI22-$LCFI21
+       .byte   0xc      # DW_CFA_def_cfa
+       .uleb128 0x1e
+       .uleb128 SIZEOF_FRAME2
+       .align  2
+$LEFDE2:
+
 #endif