* Patch for C++ build on HP-UX and to implement -static-libstdc++
@ 2011-07-29 18:12 Steve Ellcey
2011-07-29 19:57 ` Rainer Orth
0 siblings, 1 reply; 5+ messages in thread
From: Steve Ellcey @ 2011-07-29 18:12 UTC (permalink / raw)
To: gcc-patches; +Cc: dave.anglin, joseph
I recently discovered that after moving to the C++ bootstrap, the IA64
HP-UX GCC compiler would build and test OK, but if you tried to run the
installed compiler you would get an error about not being able to find
libgcc_s.so.0.
Joseph and Rainer pointed me at definining gcc_cv_ld_static_dynamic,
gcc_cv_ld_static_option, and gcc_cv_ld_dynamic_option in the
configure.ac script and that helped but resulted in a new problem.
In addition to allowing GCC to link with the static libgcc and libstdc++
these changes resulted in GCC trying to link in a static libunwind.
On IA64 HP-UX we use the system libunwind and it only comes in a shared
version. So my solution was to change gcc.c so that we only link in the
archive libunwind if we are not using the system libunwind. I did this by
having unwind_ipinfo.m4 set a new macro (USE_SYSTEM_LIBUNWIND) when
we are using the system libunwind and then checking for this in
gcc.c.
I am not sure if any other platforms use the system libunwind and if
this will cause them problem, IA64 HP-UX is the only platform to use the
system libunwind by default and I'd rather not invent a new config flag
to handle the static vs. dynamic libunwind issue unless we need to.
In addition to this problem on IA64 I found that the 32 bit PA compiler
was not building (due to a problem with not finding libgcc_s) and that
the 64 bit PA compiler was not handling -static-libstdc. This patch
fixes those problems as well with the change to configure.ac.
Hopefully, there is no issue with the configure.ac change, but I would
like some feedback on the unwind_ipinfo.m4 and gcc.c changes for
USE_SYSTEM_LIBUNWIND. I don't know if there is a better way to handle
this or not.
Tested on IA64 HP-UX and Linux and on 32 and 64 bit PA.
OK for checkin?
Steve Ellcey
sje@cup.hp.com
config/ChangeLog
2011-07-28 Steve Ellcey <sje@cup.hp.com>
* unwind_ipinfo.m4 (USE_SYSTEM_LIBUNWIND): Define.
gcc/ChangeLog
2011-07-28 Steve Ellcey <sje@cup.hp.com>
* configure.ac (gcc_cv_ld_static_dynamic): Define for *-*-hpux*.
(gcc_cv_ld_static_option): Ditto.
(gcc_cv_ld_dynamic_option): Ditto.
* gcc.c (init_spec): Use USE_SYSTEM_LIBUNWIND.
Index: config/unwind_ipinfo.m4
===================================================================
--- config/unwind_ipinfo.m4 (revision 176899)
+++ config/unwind_ipinfo.m4 (working copy)
@@ -34,4 +34,8 @@
if test x$have_unwind_getipinfo = xyes; then
AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
fi
+
+ if test x$with_system_libunwind = xyes; then
+ AC_DEFINE(USE_SYSTEM_LIBUNWIND, 1, [Define if using system unwind library.])
+ fi
])
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 176899)
+++ gcc/configure.ac (working copy)
@@ -3240,6 +3240,13 @@
*-*-solaris2*)
gcc_cv_ld_static_dynamic=yes
;;
+ *-*-hpux*)
+ if test x"$gnu_ld" = xno; then
+ gcc_cv_ld_static_dynamic=yes
+ gcc_cv_ld_static_option="-aarchive"
+ gcc_cv_ld_dynamic_option="-adefault"
+ fi
+ ;;
esac
fi
fi
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c (revision 176899)
+++ gcc/gcc.c (working copy)
@@ -1389,7 +1389,7 @@
"-lgcc",
"-lgcc_eh"
#ifdef USE_LIBUNWIND_EXCEPTIONS
-# ifdef HAVE_LD_STATIC_DYNAMIC
+# if defined(HAVE_LD_STATIC_DYNAMIC) && !defined(USE_SYSTEM_LIBUNWIND)
" %{!static:" LD_STATIC_OPTION "} -lunwind"
" %{!static:" LD_DYNAMIC_OPTION "}"
# else
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch for C++ build on HP-UX and to implement -static-libstdc++
2011-07-29 18:12 Patch for C++ build on HP-UX and to implement -static-libstdc++ Steve Ellcey
@ 2011-07-29 19:57 ` Rainer Orth
2011-07-29 19:59 ` Steve Ellcey
0 siblings, 1 reply; 5+ messages in thread
From: Rainer Orth @ 2011-07-29 19:57 UTC (permalink / raw)
To: Steve Ellcey; +Cc: gcc-patches, dave.anglin, joseph
Steve,
> Index: gcc/configure.ac
> ===================================================================
> --- gcc/configure.ac (revision 176899)
> +++ gcc/configure.ac (working copy)
> @@ -3240,6 +3240,13 @@
> *-*-solaris2*)
> gcc_cv_ld_static_dynamic=yes
> ;;
> + *-*-hpux*)
> + if test x"$gnu_ld" = xno; then
> + gcc_cv_ld_static_dynamic=yes
> + gcc_cv_ld_static_option="-aarchive"
> + gcc_cv_ld_dynamic_option="-adefault"
> + fi
> + ;;
> esac
> fi
> fi
just a nit, but could you keep the cases sorted alphabetically?
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch for C++ build on HP-UX and to implement -static-libstdc++
2011-07-29 19:57 ` Rainer Orth
@ 2011-07-29 19:59 ` Steve Ellcey
2011-08-01 14:05 ` John David Anglin
0 siblings, 1 reply; 5+ messages in thread
From: Steve Ellcey @ 2011-07-29 19:59 UTC (permalink / raw)
To: Rainer Orth; +Cc: gcc-patches, dave.anglin, joseph
On Fri, 2011-07-29 at 20:00 +0200, Rainer Orth wrote:
> Steve,
>
> > Index: gcc/configure.ac
> > ===================================================================
> > --- gcc/configure.ac (revision 176899)
> > +++ gcc/configure.ac (working copy)
> > @@ -3240,6 +3240,13 @@
> > *-*-solaris2*)
> > gcc_cv_ld_static_dynamic=yes
> > ;;
> > + *-*-hpux*)
> > + if test x"$gnu_ld" = xno; then
> > + gcc_cv_ld_static_dynamic=yes
> > + gcc_cv_ld_static_option="-aarchive"
> > + gcc_cv_ld_dynamic_option="-adefault"
> > + fi
> > + ;;
> > esac
> > fi
> > fi
>
> just a nit, but could you keep the cases sorted alphabetically?
>
> Thanks.
> Rainer
I can do that. And add a comment line like the other entries have.
Steve Ellcey
sje@cup.hp.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch for C++ build on HP-UX and to implement -static-libstdc++
2011-07-29 19:59 ` Steve Ellcey
@ 2011-08-01 14:05 ` John David Anglin
2011-08-09 1:52 ` Patch ping for build change to fix -static-libgcc build on HP-UX Steve Ellcey
0 siblings, 1 reply; 5+ messages in thread
From: John David Anglin @ 2011-08-01 14:05 UTC (permalink / raw)
To: sje; +Cc: Rainer Orth, gcc-patches, joseph
On 29-Jul-11, at 2:11 PM, Steve Ellcey wrote:
> On Fri, 2011-07-29 at 20:00 +0200, Rainer Orth wrote:
>> Steve,
>>
>>> Index: gcc/configure.ac
>>> ===================================================================
>>> --- gcc/configure.ac (revision 176899)
>>> +++ gcc/configure.ac (working copy)
>>> @@ -3240,6 +3240,13 @@
>>> *-*-solaris2*)
>>> gcc_cv_ld_static_dynamic=yes
>>> ;;
>>> + *-*-hpux*)
>>> + if test x"$gnu_ld" = xno; then
>>> + gcc_cv_ld_static_dynamic=yes
>>> + gcc_cv_ld_static_option="-aarchive"
>>> + gcc_cv_ld_dynamic_option="-adefault"
>>> + fi
>>> + ;;
>>> esac
>>> fi
>>> fi
>>
>> just a nit, but could you keep the cases sorted alphabetically?
>>
>> Thanks.
>> Rainer
>
> I can do that. And add a comment line like the other entries have.
The patch fixes the C++ build on HP-UX 11.11 for both 32 and 64-bit
targets. The HP-UX parts are ok with above revision.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Patch ping for build change to fix -static-libgcc build on HP-UX
2011-08-01 14:05 ` John David Anglin
@ 2011-08-09 1:52 ` Steve Ellcey
0 siblings, 0 replies; 5+ messages in thread
From: Steve Ellcey @ 2011-08-09 1:52 UTC (permalink / raw)
To: gcc-patches
This is a ping for my patch to fix the C++ build of GCC on HP-UX and to
fix -static-libstdc.
The original patch is at:
http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02704.html
I have updated the patch to deal with the changes that Rainer's top-level
libgcc patch made and included the new version in this email. Unfortunately,
I had to re-introduce the use of the GCC_CHECK_UNWIND_GETIPINFO to
gcc/configure.ac so that gcc.c could check the value of USE_SYSTEM_LIBUNWIND
in it's code.
Dave Anglin said the HP-UX specific parts looked OK but I would like a
build maintainer to OK the changes to and use of GCC_CHECK_UNWIND_GETIPINFO
and the USE_SYSTEM_LIBUNWIND macro.
Steve Ellcey
sje@cup.hp.com
Updated patch:
config/ChangeLog
2011-08-08 Steve Ellcey <sje@cup.hp.com>
* unwind_ipinfo.m4 (USE_SYSTEM_LIBUNWIND): Define.
gcc/ChangeLog
2011-08-08 Steve Ellcey <sje@cup.hp.com>
PR target/49967
* configure.ac (GCC_CHECK_UNWIND_GETIPINFO): Call.
(gcc_cv_ld_static_dynamic): Define for *-*-hpux*.
(gcc_cv_ld_static_option): Ditto.
(gcc_cv_ld_dynamic_option): Ditto.
* configure: Regenerate.
* config.in: Regenerate.
* aclocal.m4: Regenerate.
* gcc.c (init_spec): Use USE_SYSTEM_LIBUNWIND.
Index: config/unwind_ipinfo.m4
===================================================================
--- config/unwind_ipinfo.m4 (revision 177554)
+++ config/unwind_ipinfo.m4 (working copy)
@@ -34,4 +34,8 @@ AC_DEFUN([GCC_CHECK_UNWIND_GETIPINFO], [
if test x$have_unwind_getipinfo = xyes; then
AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
fi
+
+ if test x$with_system_libunwind = xyes; then
+ AC_DEFINE(USE_SYSTEM_LIBUNWIND, 1, [Define if using system unwind library.])
+ fi
])
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 177554)
+++ gcc/configure.ac (working copy)
@@ -1184,6 +1184,11 @@ if test $force_sjlj_exceptions = yes; th
[Define 0/1 to force the choice for exception handling model.])
fi
+# For platforms with the unwind ABI which includes an unwind library,
+# libunwind, we can choose to use the system libunwind.
+# This macro sets USE_SYSTEM_LIBUNWIND that is used in gcc.c.
+GCC_CHECK_UNWIND_GETIPINFO
+
# --------------------------------------------------------
# Build, host, and target specific configuration fragments
# --------------------------------------------------------
@@ -3231,6 +3236,14 @@ elif test x$gcc_cv_ld != x; then
gcc_cv_ld_static_option="-noso"
gcc_cv_ld_dynamic_option="-so_archive"
;;
+ # HP-UX ld uses -a flags to select between shared and archive.
+ *-*-hpux*)
+ if test x"$gnu_ld" = xno; then
+ gcc_cv_ld_static_dynamic=yes
+ gcc_cv_ld_static_option="-aarchive"
+ gcc_cv_ld_dynamic_option="-adefault"
+ fi
+ ;;
# IRIX 6 ld supports -Bstatic/-Bdynamic.
mips-sgi-irix6*)
gcc_cv_ld_static_dynamic=yes
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c (revision 177554)
+++ gcc/gcc.c (working copy)
@@ -1391,7 +1391,7 @@ init_spec (void)
"-lgcc",
"-lgcc_eh"
#ifdef USE_LIBUNWIND_EXCEPTIONS
-# ifdef HAVE_LD_STATIC_DYNAMIC
+# if defined(HAVE_LD_STATIC_DYNAMIC) && !defined(USE_SYSTEM_LIBUNWIND)
" %{!static:" LD_STATIC_OPTION "} -lunwind"
" %{!static:" LD_DYNAMIC_OPTION "}"
# else
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-08 22:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29 18:12 Patch for C++ build on HP-UX and to implement -static-libstdc++ Steve Ellcey
2011-07-29 19:57 ` Rainer Orth
2011-07-29 19:59 ` Steve Ellcey
2011-08-01 14:05 ` John David Anglin
2011-08-09 1:52 ` Patch ping for build change to fix -static-libgcc build on HP-UX Steve Ellcey
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).