This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PATCH: libffi: add MIPS O32 DWARF-2 unwind info
- From: Casey Marshall <csm at gnu dot org>
- To: java-patches at gcc dot gnu dot org
- Date: Wed, 23 Jun 2004 13:40:13 -0700
- Subject: PATCH: libffi: add MIPS O32 DWARF-2 unwind info
The attached patch adds DWARF-2 unwinding info for MIPS ffi_call_O32.
I'm kind of new to both DWARF-2 and MIPS assembly, so this may not be
completely correct. I have tried this on a modified 3.3.3 -- the
changes since then appear to have been only to the SIZEOF_ARG macro --
but have not tried it on a newer version. It seems to work, since
things like `invokethrow.java' work properly for me now.
Note that this is only for the O32 ABI. I think that N32 would be
similar (identical?) to this, but I can't test it.
Also: GCJ emits references to __gcj_personality_v0 in the assembler it
generates, as a "personality" in the CIE. I didn't know if this was
appropriate for the ffi code, so I merely omitted it. Is this ok?
(I wasn't sure where to send this patch, but I suppose GCJ users will
find it useful)
2004-06-23 Casey Marshall <csm@gnu.org>
* src/mips/o32.S: added unwind info for `ffi_call_O32'.
--
Casey Marshall || csm@gnu.org
Index: src/mips/o32.S
===================================================================
RCS file: /cvsroot/gcc/gcc/libffi/src/mips/o32.S,v
retrieving revision 1.3
diff -u -r1.3 o32.S
--- src/mips/o32.S 21 Oct 2003 19:01:56 -0000 1.3
+++ src/mips/o32.S 23 Jun 2004 19:51:11 -0000
@@ -42,13 +42,17 @@
.globl ffi_call_O32
.ent ffi_call_O32
ffi_call_O32:
-
+$LFB0:
# Prologue
SUBU $sp, SIZEOF_FRAME # Frame size
+$LCFI0:
REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer
+$LCFI1:
REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address
+$LCFI2:
move $fp, $sp
+$LCFI3:
move t9, callback # callback function pointer
REG_S flags, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG($fp) # flags
@@ -167,6 +171,51 @@
ADDU $sp, SIZEOF_FRAME # Fix stack pointer
j ra
+$LFE0:
.end ffi_call_O32
-
+
+ .section .eh_frame,"a",@progbits
+$Lframe0:
+ .4byte $LECIE0-$LSCIE0 # Length of Common Information Entry
+$LSCIE0:
+ .4byte 0x0 # CIE Identifier Tag
+ .byte 0x1 # CIE Version
+ .ascii "zR\0" # CIE Augmentation
+ .uleb128 0x1 # CIE Code Alignment Factor
+ .sleb128 4 # CIE Data Alignment Factor
+ .byte 0x1f # CIE RA Column
+ .uleb128 0x1 # Augmentation size
+ .byte 0x1b # FDE Encoding (pcrel sdata4)
+ .byte 0xc # DW_CFA_def_cfa
+ .uleb128 0x1d
+ .uleb128 0x0
+ .align 2
+$LECIE0:
+$LSFDE0:
+ .4byte $LEFDE0-$LASFDE0 # FDE Length
+$LASFDE0:
+ .4byte $LASFDE0-$Lframe0 # FDE CIE offset
+ .4byte $LFB0-. # FDE initial location
+ .4byte $LFE0-$LFB0 # FDE address range
+ .uleb128 0x0 # Augmentation size
+ .byte 0x4 # DW_CFA_advance_loc4
+ .4byte $LCFI0-$LFB0
+ .byte 0xe # DW_CFA_def_cfa_offset
+ .uleb128 0x18
+ .byte 0x4 # DW_CFA_advance_loc4
+ .4byte $LCFI2-$LCFI0
+ .byte 0x11 # DW_CFA_offset_extended_sf
+ .uleb128 0x1e
+ .sleb128 -2
+ .byte 0x11 # DW_CFA_offset_extended_sf
+ .uleb128 0x1f
+ .sleb128 -1
+ .byte 0x4 # DW_CFA_advance_loc4
+ .4byte $LCFI3-$LCFI2
+ .byte 0xc # DW_CFA_def_cfa
+ .uleb128 0x1e
+ .uleb128 0x18
+ .align 2
+$LEFDE0:
+
#endif