Patchwork Patch ping for build change to fix -static-libgcc build on HP-UX

login
register
mail settings
Submitter Steve Ellcey
Date Aug. 8, 2011, 10:51 p.m.
Message ID <201108082251.p78Mp5Z11769@catbert.cup.hp.com>
Download mbox | patch
Permalink /patch/109108/
State New
Headers show

Comments

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

Patch

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