This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, HPUX] Simplified patch to fix HP-UX C++ bootstrap
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: dave dot anglin at bell dot net, gcc-patches at gcc dot gnu dot org
- Date: Wed, 17 Aug 2011 13:16:44 -0700 (PDT)
- Subject: [patch, HPUX] Simplified patch to fix HP-UX C++ bootstrap
After some reconsideration I have changed my patch to fix the
-static-libstdc++ build on HP-UX and the bootstrap with C++ build
problem. Originally, I set gcc_cv_ld_static_option to "-aarchive" to
only search archive libraries and this caused problems on IA64 HP-UX
where we used the system unwind library and which only existed as a
shared library.
In this patch, I use "-aarchive_shared" instead of "-aarchive" so that
the linker will look for archive libraries first and then for shared
libraries. This has the advantage of fixing the HP-UX problem while not
requiring any changes that are not specific to HP-UX.
The reason I didn't do this initially is that when using
"-aarchive_shared", the linker will search directory "a" for archive
libraries, then if it didn't find one, search "a" for a shared library.
Only then will it go on to search directory "b" for an archive library.
I wasn't sure this would give us the behaviour we wanted but after some
testing, it seems to work OK so I would like to check it in.
Dave, I tested this on HPPA as well as IA64, and it looks OK to me. Does
it look good to you? If so I will go ahead and check it in.
Steve Ellcey
sje@cup.hp.com
2011-08-17 Steve Ellcey <sje@cup.hp.com>
PR target/49967
* configure.ac (gcc_cv_ld_static_dynamic): Define for *-*-hpux*.
(gcc_cv_ld_static_option): Ditto.
(gcc_cv_ld_dynamic_option): Ditto.
* configure: Regenerate.
Index: configure.ac
===================================================================
--- configure.ac (revision 177820)
+++ configure.ac (working copy)
@@ -3239,6 +3239,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_shared"
+ gcc_cv_ld_dynamic_option="-adefault"
+ fi
+ ;;
# IRIX 6 ld supports -Bstatic/-Bdynamic.
mips-sgi-irix6*)
gcc_cv_ld_static_dynamic=yes