add unwind infor for *go_closure; reorder the labels to make thing more clear
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
diff --git a/src/mips/n32.S b/src/mips/n32.S
index 750555e..63f79a9 100644
--- a/src/mips/n32.S
+++ b/src/mips/n32.S
@@ -53,19 +53,19 @@
.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
diff --git a/src/mips/o32.S b/src/mips/o32.S
index 8ec6649..69324e6 100644
--- a/src/mips/o32.S
+++ b/src/mips/o32.S
@@ -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