small fixes for libunwind support

David Mosberger davidm@napali.hpl.hp.com
Thu Dec 11 01:06:00 GMT 2003


The patch below has a small fix for the libunwind-version of
_Unwind_SetGR() and also updates the libunwind support to check
whether _Unwind_Resume() is defined by -lunwind.  If so, there is no
need to build and include unwind-libunwind.o in libgcc_eh.a.

Please apply if it looks OK.

	--david

gcc/ChangeLog

2003-12-10  David Mosberger  <davidm@hpl.hp.com>

	* unwind-libunwind.c (_Unwind_SetGR): Clear the NaT bit as
	required by C++ ABI for Itanium.

	* t-libunwind (LIB2ADDEH): Remove unwind-libunwind.c.
	* t-libunwind-no-eh: New file.

	* configure.in: Check libunwind for _Unwind_Resume() and it it's
	present, set libunwind_has_eh_support to "yes".

	* config.gcc (ia64*-*-linux*): If $libunwind_has_eh_support is
	set to yes, use t-libunwind, otherwise, use t-libunwind-no-eh.

Index: gcc/config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.412
diff -u -r1.412 config.gcc
--- gcc/config.gcc	9 Dec 2003 17:32:55 -0000	1.412
+++ gcc/config.gcc	11 Dec 2003 01:01:23 -0000
@@ -1245,7 +1245,11 @@
 	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
 	if test x"$use_libunwind_exceptions" = xyes; then
-	  tmake_file="$tmake_file t-libunwind"
+	  if test x"$libunwind_has_eh_support" = xyes; then
+	    tmake_file="$tmake_file t-libunwind"
+	  else
+	    tmake_file="$tmake_file t-libunwind-no-eh"
+	  fi
 	fi
 	;;
 ia64*-*-hpux*)
Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.758
diff -u -r1.758 configure.in
--- gcc/configure.in	7 Dec 2003 16:12:25 -0000	1.758
+++ gcc/configure.in	11 Dec 2003 01:01:24 -0000
@@ -957,6 +957,8 @@
 if test x"$use_libunwind_exceptions" = xyes; then
    AC_DEFINE(USE_LIBUNWIND_EXCEPTIONS, 1,
 	[Define if gcc should use -lunwind.])
+   AC_CHECK_LIB(unwind, _Unwind_Resume, libunwind_has_eh_support=yes,
+	libunwind_has_eh_support=no)
 fi
 
 # --------------------------------------------------------
Index: gcc/unwind-libunwind.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-libunwind.c,v
retrieving revision 1.7
diff -u -r1.7 unwind-libunwind.c
--- gcc/unwind-libunwind.c	20 Nov 2003 22:53:02 -0000	1.7
+++ gcc/unwind-libunwind.c	11 Dec 2003 01:01:24 -0000
@@ -124,6 +124,11 @@
   /* Note: here we depend on the fact that general registers are
      expected to start with register number 0!  */
   unw_set_reg (&context->cursor, index, val);
+#ifdef UNW_TARGET_IA64
+  if (index >= UNW_IA64_GR && index <= UNW_IA64_GR + 127)
+    /* Clear the NaT bit. */
+    unw_set_reg (&context->cursor, UNW_IA64_NAT + (index - UNW_IA64_GR), 0);
+#endif
 }
 
 /* Retrieve the return address for CONTEXT.  */
Index: gcc/config/t-libunwind
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/t-libunwind,v
retrieving revision 1.4
diff -u -r1.4 t-libunwind
--- gcc/config/t-libunwind	20 Nov 2003 22:56:55 -0000	1.4
+++ gcc/config/t-libunwind	11 Dec 2003 01:01:24 -0000
@@ -2,5 +2,4 @@
 # so that the resulting libgcc_s.so has the necessary DT_NEEDED entry for
 # libunwind.
 SHLIB_LC = -lunwind -lc
-LIB2ADDEH = $(srcdir)/unwind-libunwind.c $(srcdir)/unwind-sjlj.c \
-	    $(srcdir)/unwind-c.c
+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c



More information about the Gcc-patches mailing list