Patch: Regression PR target/26792, Check for _Unwind_IPInfo

Steve Ellcey sje@cup.hp.com
Mon Jul 17 23:07:00 GMT 2006


I sent this patch to gcc-patches this morning but forgot to send it to
libstdc++.  Here is a copy of the original mail, please include
gcc-patches in any follow-up.

Steve Ellcey
sje@cup.hp.com

--

>From sje Mon Jul 17 09:24:22 2006
To: gcc-patches@gcc.gnu.org
Subject: Patch: Regression PR target/26792, Check for _Unwind_IPInfo
Reply-to: sje@cup.hp.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here is a proposed patch for PR target/26792, the fact that darwin does
not have the _Unwind_GetIPInfo entry point in its unwind library.  HP-UX
has the same problem and I fixed it by adding _Unwind_GetIPInfo to
libgcc.  This fix checks for _Unwind_GetIPInfo and ifdef's the use of it
in libstdc++-v3.  If this patch is accepted I would like to remove the
definition of _Unwind_GetIPInfo from the IA64 HP-UX libgcc and then
modify (or have someone else modify) the libjava code to use the same
check and ifdef around its use of _Unwind_GetIPInfo.  Using it for Java
is why I put the definition of GCC_CHECK_UNWIND_GETIPINFO in the config
directory and not in the libstdc++-v3 directory.

Tested on IA64 HP-UX (with the _Unwind_GetIPInfo removed) and on 
IA64 Linux and on HPPA HP-UX.

OK for checkin?



2006-07-17  Steve Ellcey  <sje@cup.hp.com>

	PR target/26792
	* unwind_ipinfo.m4: New.

Index: unwind_ipinfo.m4
===================================================================
--- unwind_ipinfo.m4	(revision 0)
+++ unwind_ipinfo.m4	(revision 0)
@@ -0,0 +1,22 @@
+dnl
+dnl Check whether _Unwind_GetIPInfo is available.
+dnl
+AC_DEFUN([GCC_CHECK_UNWIND_GETIPINFO], [
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -fno-exceptions"
+  AC_MSG_CHECKING([for _Unwind_GetIPInfo])
+  AC_CACHE_VAL(gcc_cv_getipinfo, [
+  AC_TRY_LINK([extern "C" { extern void _Unwind_GetIPInfo(); }],
+      [_Unwind_GetIPInfo();],
+      [gcc_cv_getipinfo=yes],
+      [gcc_cv_getipinfo=no])
+  ])
+  if test $gcc_cv_getipinfo = yes; then
+    AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
+  fi
+  AC_MSG_RESULT($gcc_cv_getipinfo)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+])

2006-07-17  Steve Ellcey  <sje@cup.hp.com>

	PR target/26792
	* configure.ac: Use GCC_CHECK_UNWIND_GETIPINFO to
	define HAVE_GETIPINFO.
	* libsupc++/eh_personality.cc: Check HAVE_GETIPINFO.

Index: configure.ac
===================================================================
--- configure.ac	(revision 115510)
+++ configure.ac	(working copy)
@@ -167,6 +167,9 @@ if $GLIBCXX_IS_NATIVE; then
   # For TLS support.
   GCC_CHECK_TLS
 
+  # For _Unwind_GetIPInfo.
+  GCC_CHECK_UNWIND_GETIPINFO
+
   AC_LC_MESSAGES
 
   AC_TRY_COMPILE(
@@ -282,6 +285,9 @@ else
     AC_DEFINE(HAVE_TANL)
     AC_DEFINE(HAVE_TANHL)
   fi
+
+  # Assume we have _Unwind_GetIPInfo for cross-compiles.
+  AC_DEFINE(HAVE_GETIPINFO)
 
 fi
 
Index: libsupc++/eh_personality.cc
===================================================================
--- libsupc++/eh_personality.cc	(revision 115510)
+++ libsupc++/eh_personality.cc	(working copy)
@@ -431,7 +431,11 @@ PERSONALITY_FUNCTION (int version,
   // Parse the LSDA header.
   p = parse_lsda_header (context, language_specific_data, &info);
   info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
+#ifdef HAVE_GETIPINFO
   ip = _Unwind_GetIPInfo (context, &ip_before_insn);
+#else
+  ip = _Unwind_GetIP (context);
+#endif
   if (! ip_before_insn)
     --ip;
   landing_pad = 0;



More information about the Libstdc++ mailing list