[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

patch for GCC v3.3.2



Could the attached patch please be considered for inclusion in the
Debian GCC v3.3 package?  As you can see from the attached message, I
also submitted the patch for inclusion in GCC v3.3.3 and the
equivalent fixes are already in pre-v3.4.  The bug-fixes are important
because NPTL-enabled glibc won't work properly on ia64 unless GCC is
built with libunwind-support enabled (libunwind support is automatically
enabled if libunwind v0.95 is installed on the build-machine; I'm working
with Al Stone to get the Debian package for libunwind v0.95 be available
by default on ia64 for Debian/unstable).

Thanks,

	--david

--------------------------------------------------------
From: David Mosberger <davidm@linux.hpl.hp.com>
To: dr@integrable-solutions.net
cc: davidm@linux.hpl.hp.com
Subject: patch for GCC v3.3.3
Date: Tue, 2 Dec 2003 10:45:26 -0800
Reply-To: davidm@hpl.hp.com
X-URL: http://www.hpl.hp.com/personal/David_Mosberger/

Hi Gabriel,

Jim Wilson told me that you're the release manager for GCC v3.3.3.  I
have a small patch consisting of fixes backported from pre-v3.4 which
are needed on IA-64 to get the libunwind support working.  Working
libunwind support is getting more important on IA-64 now because the
latest versions of glibc stress the unwinder much more and the
built-in unwinder for IA-64 (config/ia64/unwind-ia64.c) is hopelessly
broken (I looked into fixing the built-in unwinder, but the scope of
the fixes would be large and would have a real potential of
introducing a new set of bugs so I concluded it's better to leave the
built-in unwinder as is and switch to libunwind instead).  The patch
should be completely safe because it won't affect the building of GCC
in any fashion unless libunwind is installed.  And even then libunwind
support could easily be turned off with
--disable-libunwind-exceptions, should there be some unexpected
problems.  Also, I have tested this patch with an NPTL-enabled glibc
and "make check" passes all tests with this patch applied.

One caveat: the patch below is relative to the GCC as distributed by
Debian package gcc-3.3-3.3.2ds5.  I believe this is very close to the
official GCC v3.3.2, but if there are any unexpected problems, please
let me know.

Thanks,

	--david

gcc/ChangeLog

2003-11-29  James E Wilson  <wilson@specifixinc.com>

	* gcc.c (init_spec): Pass -lunwind to init_gcc_specs in eh_name
	instead of in shared_name.

2003-11-20 David Mosberger  <davidm@hpl.hp.com>

	* config/t-libunwind (LIB2ADDEH): Add unwind-c.c.
	(SHLIB_LC): Define.
	* unwind-libunwind.c (_Unwind_GetCFA): Implement.
	(_Unwind_GetBSP) [UNW_TARGET_IA64]: New function.

diff -urN gcc-3.3-3.3.2ds5/src/gcc/config/t-libunwind gcc-3.3-3.3.2ds5-davidm/src/gcc/config/t-libunwind
--- gcc-3.3-3.3.2ds5/src/gcc/config/t-libunwind	2003-08-10 16:11:27.000000000 -0700
+++ gcc-3.3-3.3.2ds5-davidm/src/gcc/config/t-libunwind	2003-12-02 10:09:16.000000000 -0800
@@ -1 +1,6 @@
-LIB2ADDEH = $(srcdir)/unwind-libunwind.c $(srcdir)/unwind-sjlj.c
+# Override the default value from t-slibgcc-elf-ver and mention -lunwind
+# 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
diff -urN gcc-3.3-3.3.2ds5/src/gcc/gcc.c gcc-3.3-3.3.2ds5-davidm/src/gcc/gcc.c
--- gcc-3.3-3.3.2ds5/src/gcc/gcc.c	2003-12-02 10:05:06.000000000 -0800
+++ gcc-3.3-3.3.2ds5-davidm/src/gcc/gcc.c	2003-12-02 10:12:36.000000000 -0800
@@ -1556,12 +1556,14 @@
 #else
 			    "-lgcc_s%M"
 #endif
+			    ,
+			    "-lgcc",
+			    "-lgcc_eh"
 #ifdef USE_LIBUNWIND_EXCEPTIONS
 			    " -lunwind"
 #endif
-			    ,
-			    "-lgcc",
-			    "-lgcc_eh");
+			    );
+
 	    p += 5;
 	    in_sep = 0;
 	  }
@@ -1577,7 +1579,11 @@
 #endif
 			    ,
 			    "libgcc.a%s",
-			    "libgcc_eh.a%s");
+			    "libgcc_eh.a%s"
+#ifdef USE_LIBUNWIND_EXCEPTIONS
+			    "libunwind.a%s"
+#endif
+			    );
 	    p += 10;
 	    in_sep = 0;
 	  }
diff -urN gcc-3.3-3.3.2ds5/src/gcc/unwind-libunwind.c gcc-3.3-3.3.2ds5-davidm/src/gcc/unwind-libunwind.c
--- gcc-3.3-3.3.2ds5/src/gcc/unwind-libunwind.c	2003-08-10 16:11:26.000000000 -0700
+++ gcc-3.3-3.3.2ds5-davidm/src/gcc/unwind-libunwind.c	2003-12-01 22:58:56.000000000 -0800
@@ -110,9 +110,11 @@
 _Unwind_Word
 _Unwind_GetCFA (struct _Unwind_Context *context)
 {
-  /* ??? Is there any way to get this information?  */
-  return NULL;
-} 
+  unw_word_t ret;
+
+  unw_get_reg (&context->cursor, UNW_IA64_SP, &ret);
+  return ret;
+}
 
 /* Overwrite the saved value for register REG in CONTEXT with VAL.  */
 
@@ -167,6 +169,19 @@
   return NULL;
 }
 
+#ifdef UNW_TARGET_IA64
+
+_Unwind_Word
+_Unwind_GetBSP (struct _Unwind_Context *context)
+{
+  unw_word_t ret;
+
+  unw_get_reg (&context->cursor, UNW_IA64_BSP, &ret);
+  return ret;
+}
+
+#endif
+
 #include "unwind.inc"
 
 #endif /* !__USING_SJLJ_EXCEPTIONS__ */



Reply to: