public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* _Unwind_GetIPInfo Redux: Patch for PR target/27880
@ 2008-10-15 17:54 sje
  2008-10-18 17:19 ` Matthias Klose
  2008-10-27 21:03 ` Steve Ellcey
  0 siblings, 2 replies; 6+ messages in thread
From: sje @ 2008-10-15 17:54 UTC (permalink / raw)
  To: gcc-patches


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/configure.ac 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
and HAVE_GETIPINFO into the GCC_CHECK_UNWIND_GETIPINFO autoconf macro
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.

Comments?

Steve Ellcey
sje@cup.hp.com



config/ChangeLog

2008-10-15  Steve Ellcey  <sje@cup.hp.com>

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

gcc/ChangeLog

2008-10-15  Steve Ellcey  <sje@cup.hp.com>

	PR target/27880
	* configure.ac (GCC_CHECK_UNWIND_GETIPINFO): Use to set HAVE_GETIPINFO.
	* configure: Regenerate.

libstdc++-v3/ChangeLog
	
2008-10-15  Steve Ellcey  <sje@cup.hp.com>

	* configure: Regenerate to get new GCC_CHECK_UNWIND_GETIPINFO.

libjava/ChangeLog
	
2008-10-15  Steve Ellcey  <sje@cup.hp.com>

	* 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
-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).
 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_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.])
   fi
-  AC_MSG_RESULT($gcc_cv_getipinfo)
-  CXXFLAGS="$ac_save_CXXFLAGS"
-  AC_LANG_RESTORE
 ])
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 141127)
+++ gcc/configure.ac	(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.
-AC_ARG_WITH(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
-        AC_DEFINE(HAVE_GETIPINFO, 1,
-[Define to 1 if system unwind library has _Unwind_GetIPInfo.])
-fi
+GCC_CHECK_UNWIND_GETIPINFO
 
 # --------------------------------------------------------
 # Build, host, and target specific configuration fragments
@@ -1421,20 +1415,6 @@ if test x$enable___cxa_atexit = xyes || 
   fi
 fi
 
-use_getipinfo=yes
-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
-fi
-GCC_TARGET_TEMPLATE(HAVE_GETIPINFO)
-if test x$use_getipinfo = xyes; then
-   AC_DEFINE(HAVE_GETIPINFO, 1,
-	[Define to 1 if system unwind library has _Unwind_GetIPInfo.])
-else
-   echo "The system unwind library does not support _Unwind_GetIPInfo."
-fi
-
 # Look for a file containing extra machine modes.
 if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then
   extra_modes_file='$(srcdir)'/config/${extra_modes}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _Unwind_GetIPInfo Redux: Patch for PR target/27880
  2008-10-15 17:54 _Unwind_GetIPInfo Redux: Patch for PR target/27880 sje
@ 2008-10-18 17:19 ` Matthias Klose
  2008-10-27 21:03 ` Steve Ellcey
  1 sibling, 0 replies; 6+ messages in thread
From: Matthias Klose @ 2008-10-18 17:19 UTC (permalink / raw)
  To: sje; +Cc: gcc-patches

sje@cup.hp.com schrieb:
> 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/configure.ac 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
> and HAVE_GETIPINFO into the GCC_CHECK_UNWIND_GETIPINFO autoconf macro
> 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.
> 
> Comments?

Built a native ia64-linux compiler configured --with-system-libunwind , with ada enabled, after
regenerating the config files in libstdc==-v3 and libjava. No regressions seen in the testsuite
compared to a build without this patch.

  Matthias

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _Unwind_GetIPInfo Redux: Patch for PR target/27880
  2008-10-15 17:54 _Unwind_GetIPInfo Redux: Patch for PR target/27880 sje
  2008-10-18 17:19 ` Matthias Klose
@ 2008-10-27 21:03 ` Steve Ellcey
  2008-10-28  3:01   ` Paolo Carlini
  1 sibling, 1 reply; 6+ messages in thread
From: Steve Ellcey @ 2008-10-27 21:03 UTC (permalink / raw)
  To: gcc-patches, libstdc++, mark, paolo.carlini

Mark and Paolo,

You were discussing issues about cross configuration a while back
and config tests that do link tests when building libstdc++.

GCC_CHECK_UNWIND_GETIPINFO is one of those tests and the patch

	http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00647.html

is my attempt to address this issue while also fixing PR target/27880
which is on the 4.4 serious regression list.  Do either of you have an
opinion on the approach I have taken?  It is not ideal but I don't have
any better ideas on how to handle it.

Steve Ellcey
sje@cup.hp.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _Unwind_GetIPInfo Redux: Patch for PR target/27880
  2008-10-27 21:03 ` Steve Ellcey
@ 2008-10-28  3:01   ` Paolo Carlini
  2008-11-28  9:33     ` Andrew Pinski
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Carlini @ 2008-10-28  3:01 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: gcc-patches, libstdc++, mark

Hi,

and first many thanks for working on this issue.
> You were discussing issues about cross configuration a while back
> and config tests that do link tests when building libstdc++.
>
> GCC_CHECK_UNWIND_GETIPINFO is one of those tests and the patch
>
> 	http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00647.html
>
> is my attempt to address this issue while also fixing PR target/27880
> which is on the 4.4 serious regression list.  Do either of you have an
> opinion on the approach I have taken?  It is not ideal but I don't have
> any better ideas on how to handle it.
>   
As far as I understand the rationale and the actual implementation of
your patch I like it and consider it a big improvement compared to the
current situation.

If/when the patch will be applied, you should also change
libstdc++/configure.ac, moving GCC_CHECK_UNWIND_GETIPINFO ouside the
block if $GLIBCXX_IS_NATIVE, before it, thus run unconditionally. This
additional change is pre-approved.

Thanks again,
Paolo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _Unwind_GetIPInfo Redux: Patch for PR target/27880
  2008-10-28  3:01   ` Paolo Carlini
@ 2008-11-28  9:33     ` Andrew Pinski
  2008-11-28 10:30       ` Paolo Carlini
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Pinski @ 2008-11-28  9:33 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: Steve Ellcey, gcc-patches, libstdc++, mark

On Mon, Oct 27, 2008 at 1:57 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> and first many thanks for working on this issue.
>> You were discussing issues about cross configuration a while back
>> and config tests that do link tests when building libstdc++.
>>
>> GCC_CHECK_UNWIND_GETIPINFO is one of those tests and the patch
>>
>>       http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00647.html
>>
>> is my attempt to address this issue while also fixing PR target/27880
>> which is on the 4.4 serious regression list.  Do either of you have an
>> opinion on the approach I have taken?  It is not ideal but I don't have
>> any better ideas on how to handle it.
>>
> As far as I understand the rationale and the actual implementation of
> your patch I like it and consider it a big improvement compared to the
> current situation.
>
> If/when the patch will be applied, you should also change
> libstdc++/configure.ac, moving GCC_CHECK_UNWIND_GETIPINFO ouside the
> block if $GLIBCXX_IS_NATIVE, before it, thus run unconditionally. This
> additional change is pre-approved.

This causes libstdc++ on darwin 8.11 to contain a reference to
_Unwind_GetIPInfo which is incorrect.  libgcc in Darwin 8.11 does not
contain _Unwind_GetIPInfo (only 9 and above).

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: _Unwind_GetIPInfo Redux: Patch for PR target/27880
  2008-11-28  9:33     ` Andrew Pinski
@ 2008-11-28 10:30       ` Paolo Carlini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Carlini @ 2008-11-28 10:30 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Steve Ellcey, gcc-patches, libstdc++, mark

Andrew Pinski wrote:
> This causes libstdc++ on darwin 8.11 to contain a reference to
> _Unwind_GetIPInfo which is incorrect.  libgcc in Darwin 8.11 does not
> contain _Unwind_GetIPInfo (only 9 and above).
>   
Looks like tweaking a bit unwind_ipinfo.m4 should be enough...

Paolo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-11-28  9:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-15 17:54 _Unwind_GetIPInfo Redux: Patch for PR target/27880 sje
2008-10-18 17:19 ` Matthias Klose
2008-10-27 21:03 ` Steve Ellcey
2008-10-28  3:01   ` Paolo Carlini
2008-11-28  9:33     ` Andrew Pinski
2008-11-28 10:30       ` Paolo Carlini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).