[HPUX] Simplified patch to fix HP-UX C++ bootstrap

Message ID 201108172016.p7HKGio01528@catbert.cup.hp.com
State New
Headers show

Commit Message

Steve Ellcey Aug. 17, 2011, 8:16 p.m.
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

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
+      # 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.