This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

_Unwind_GetIPInfo Redux: Patch for PR target/27880

I have been looking at the _Unwind_GetIPInfo issues again.  There are two
problems, one is PR target/27880 where static linking on IA64 Linux does
not work when GCC is built with --with-system-libunwind and the other is
the fact that we use link based tests to determine if _Unwind_GetIPInfo
exists in the libstdc++-v3 and libjava configures and this does not
work if you are building cross-compilers.  This patch is my attempt to
address both issues.

At first I tried to fix the link test in the gcc directory to set or not
set HAVE_GETIPINFO correctly.  I think that if we are on IA64 Linux and
we specify --with-system-libunwind then HAVE_GETIPINFO should not be set
because the IA64 system unwind library does not have this routine in it.

This doesn't work though because _Unwind_GetIPInfo exists in libgcc (from
unwind-compat.o) on IA64 so even if the system libunwind doesn't have
_Unwind_GetIPInfo we still think it does because we find it in libgcc.
There doesn't seem to be anyway around this problem since GCC's that have
this have already been released and could be used to build the latest GCC.

My second thought was to set the default values for with_system_libunwind
and for HAVE_GETIPINFO in gcc/ and then allow those
values to be overridden in config.gcc (based on target) or with the
--with-system-libunwind option to configure.  This seems doable and
reasonable but it doesn't address the checks in libstdc++-v3 and libjava
where we would still need to do link tests to check for GetIPInfo and we
don't want to do that (for cross-compiling reasons) and they won't work
correctly because of the _Unwind_GetIPInfo in libgcc.  I couldn't think
of any good way for the HAVE_GETIPINFO value set in the gcc directory
to be communicated to the libstdc++-v3 and libjava configures.

So my final fix was to put the default settings of with_system_libunwind
in config/unwind_ipinfo.m4 and let that macro use the target variable
and the --with-system-libunwind configure option to change the defaults
if needed.  Then gcc, libstdc++-v3, and libjava will all use the same
method to determine HAVE_GETIPINFO and it won't be a link based test.

The only problem is that we now have an autoconf macro looking directly
at the $target variable.  While I don't think that is ideal, I think it
might be acceptable as a way to address both of the _Unwind_GetIPInfo
issues that we want to fix.

Here is a patch, I am still testing it but I wanted to send it out and
see what people think, see if this is an acceptable approach, or if
someone might have a better idea of how to fix the problem.


Steve Ellcey


2008-10-15  Steve Ellcey  <>

	PR target/27880
	* unwind_ipinfo.m4 (GCC_CHECK_UNWIND_GETIPINFO): Change from
	link test to target based test.


2008-10-15  Steve Ellcey  <>

	PR target/27880
	* configure: Regenerate.

2008-10-15  Steve Ellcey  <>

	* configure: Regenerate to get new GCC_CHECK_UNWIND_GETIPINFO.

2008-10-15  Steve Ellcey  <>

	* configure: Regenerate to get new GCC_CHECK_UNWIND_GETIPINFO.

Index: config/unwind_ipinfo.m4
--- config/unwind_ipinfo.m4	(revision 141127)
+++ config/unwind_ipinfo.m4	(working copy)
@@ -1,22 +1,31 @@
-dnl Check whether _Unwind_GetIPInfo is available.
+dnl Check whether _Unwind_GetIPInfo is available without doing a link
+dnl test so we can use this with libstdc++-v3 and libjava.  Need to
+dnl use $target to set defaults because automatic checking is not possible
+dnl without a link test (and maybe even with a link test).
-  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_ARG_WITH(system-libunwind,
+  [  --with-system-libunwind use installed libunwind])
+  # If system-libunwind was not specifically set, pick a default setting.
+  if test x$with_system_libunwind = x; then
+    case ${target} in
+      ia64-*-hpux*) with_system_libunwind=yes ;;
+      *) with_system_libunwind=no ;;
+    esac
+  fi
+  # Based on system-libunwind and target, do we have ipinfo?
+  if  test x$with_system_libunwind = xyes; then
+    case ${target} in
+      ia64-*-*) have_unwind_getipinfo=no ;;
+      *) have_unwind_getipinfo=yes ;;
+    esac
+  else
+     have_unwind_getipinfo=yes
+  fi
+  if test x$have_unwind_getipinfo = xyes; then
     AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
-  AC_MSG_RESULT($gcc_cv_getipinfo)
Index: gcc/
--- gcc/	(revision 141127)
+++ gcc/	(working copy)
@@ -1188,14 +1188,8 @@ fi
 # For platforms with the unwind ABI which includes an unwind library,
 # libunwind, we can choose to use the system libunwind.
-[  --with-system-libunwind use installed libunwind])
 # config.gcc also contains tests of with_system_libunwind.
-if test x$with_system_libunwind = xyes; then
-[Define to 1 if system unwind library has _Unwind_GetIPInfo.])
 # --------------------------------------------------------
 # Build, host, and target specific configuration fragments
@@ -1421,20 +1415,6 @@ if test x$enable___cxa_atexit = xyes || 
-if test x$with_system_libunwind = xyes; then
-   if test x$host = x$target; then
-     AC_SEARCH_LIBS(_Unwind_GetIPInfo, unwind,, [use_getipinfo=no])
-   fi
-if test x$use_getipinfo = xyes; then
-	[Define to 1 if system unwind library has _Unwind_GetIPInfo.])
-   echo "The system unwind library does not support _Unwind_GetIPInfo."
 # Look for a file containing extra machine modes.
 if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]