[PATCH applied] sh-linux: Fix failures on libjava

kaz Kojima kkojima@rr.iij4u.or.jp
Thu Aug 14 00:13:00 GMT 2003


Hi,

Now many libjava tests using dwarf2 exception don't pass on sh-linux.
SH-3/4 linux port uses a fake register number 16 to save the return
address in MD_FALLBACK_FRAME_STATE_FOR. This saved value will be read with
_Unwind_GetGR which obtains the register size with dwarf_reg_size_table.
Currently dwarf_reg_size_table[16] isn't set and _Unwind_GetGR aborts
for this.
With this patch, dwarf_reg_size_table[16] is set to 4 and all related
failures on libjava tests went away. It's not so good but anyway works
as a workaround.
BTW, we can use the slot for the zero register for this purpose in
SHmedia as alpha does, though there is no MD_FALLBACK_FRAME_STATE_FOR
for sh64-linux yet.

Regtested on sh4-unknown-linux-gnu and sh64-unknown-linux-gnu with
no new regressions. Committed to the mainline.

Regards,
	kaz
--
2003-08-13  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/linux.h (DBX_REGISTER_NUMBER): Define so to map a
	special index for MD_FALLBACK_FRAME_STATE_FOR to itself.

diff -u3prN ORIG/gcc/gcc/config/sh/linux.h LOCAL/gcc/gcc/config/sh/linux.h
--- ORIG/gcc/gcc/config/sh/linux.h	Sun Aug  3 09:16:46 2003
+++ LOCAL/gcc/gcc/config/sh/linux.h	Tue Aug 12 15:09:34 2003
@@ -277,3 +277,14 @@ do { \
 
 #endif /* defined (__SH5__) */
 #endif /* IN_LIBGCC2 */
+
+/* For SH3 and SH4, we use a slot of the unwind frame which correspond
+   to a fake register number 16 as a placeholder for the return address
+   in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
+   _Unwind_GetGR which uses dwarf_reg_size_table to get the size of
+   the register.  So the entry of dwarf_reg_size_table corresponding to
+   this slot must be set.  To do this, we redefine DBX_REGISTER_NUMBER
+   so as to return itself for 16.  */
+#undef DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(REGNO) \
+  ((! TARGET_SH5 && (REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))



More information about the Gcc-patches mailing list