]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/18153 (-static-libgcc links in libunwind.so.7)
authorH.J. Lu <hongjiu.lu@intel.com>
Thu, 16 Dec 2004 00:15:03 +0000 (00:15 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Thu, 16 Dec 2004 00:15:03 +0000 (16:15 -0800)
2004-12-15  H.J. Lu  <hongjiu.lu@intel.com>

PR target/18153
* configure.ac: Define HAVE_LD_STATIC_DYNAMIC if linker supports
-Bstatic/-Bdynamic option.
* config.in: Regenerated.
* configure: Likewise.

* gcc.c (init_spec): Pass -Bstatic/-Bdynamic to ld for static
-lunwind if possible.

From-SVN: r92234

gcc/ChangeLog
gcc/config.in
gcc/configure
gcc/configure.ac
gcc/gcc.c

index 2d64e510f8e3de5a48aa3f38a49cdc520770dd52..2f3d990a36087208e26d507502d831021252f057 100644 (file)
@@ -1,3 +1,14 @@
+2004-12-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/18153
+       * configure.ac: Define HAVE_LD_STATIC_DYNAMIC if linker supports
+       -Bstatic/-Bdynamic option.
+       * config.in: Regenerated.
+       * configure: Likewise.
+
+       * gcc.c (init_spec): Pass -Bstatic/-Bdynamic to ld for static
+       -lunwind if possible.
+
 2004-12-15  Richard Henderson  <rth@redhat.com>
 
         PR target/19010
index 4d0a2e1220e486a8f7a813e1cda80f5667950a6b..4d47fbea162ad64411509bded63c054c56b3c7a4 100644 (file)
    a read-write section. */
 #undef HAVE_LD_RO_RW_SECTION_MIXING
 
+/* Define if your linker supports -Bstatic/-Bdynamic option. */
+#undef HAVE_LD_STATIC_DYNAMIC
+
 /* Define to 1 if you have the <limits.h> header file. */
 #undef HAVE_LIMITS_H
 
index 33a3877eb906c09abf14848aa25a5d30d2db7ed9..0232ac07566062fc9718a879ddb5d2052be3e11a 100755 (executable)
 echo "$as_me:$LINENO: result: $gcc_cv_ld_pie" >&5
 echo "${ECHO_T}$gcc_cv_ld_pie" >&6
 
+echo "$as_me:$LINENO: checking linker -Bstatic/-Bdynamic option" >&5
+echo $ECHO_N "checking linker -Bstatic/-Bdynamic option... $ECHO_C" >&6
+gcc_cv_ld_static_dynamic=no
+if test $in_tree_ld = yes ; then
+  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10; then
+    gcc_cv_ld_static_dynamic=yes
+  fi
+elif test x$gcc_cv_ld != x; then
+       # Check if linker supports -Bstatic/-Bdynamic option
+       if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
+         && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
+               gcc_cv_ld_static_dynamic=yes
+       fi
+fi
+if test x"$gcc_cv_ld_static_dynamic" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LD_STATIC_DYNAMIC 1
+_ACEOF
+
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_ld_static_dynamic" >&5
+echo "${ECHO_T}$gcc_cv_ld_static_dynamic" >&6
+
 case "$target" in
   *-*-linux*)
     echo "$as_me:$LINENO: checking linker --as-needed support" >&5
index 9b991edf9ccd7722062f4f78d04c861f177bfa0e..ec6942b43ec40864316d3cb7555fe124ce3ee1b8 100644 (file)
@@ -2617,6 +2617,25 @@ if test x"$gcc_cv_ld_pie" = xyes; then
 fi
 AC_MSG_RESULT($gcc_cv_ld_pie)
 
+AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
+gcc_cv_ld_static_dynamic=no
+if test $in_tree_ld = yes ; then
+  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10; then
+    gcc_cv_ld_static_dynamic=yes
+  fi
+elif test x$gcc_cv_ld != x; then
+       # Check if linker supports -Bstatic/-Bdynamic option
+       if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
+         && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
+               gcc_cv_ld_static_dynamic=yes
+       fi
+fi
+if test x"$gcc_cv_ld_static_dynamic" = xyes; then
+       AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
+[Define if your linker supports -Bstatic/-Bdynamic option.])
+fi
+AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
+
 case "$target" in
   *-*-linux*)
     AC_CACHE_CHECK(linker --as-needed support,
index dd69b6eb6d049fda4af6721e4beea9809d5e6ecc..4e053b81f5221fc8815ff0d23d6788ce8c88247e 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1647,7 +1647,11 @@ init_spec (void)
                            "-lgcc",
                            "-lgcc_eh"
 #ifdef USE_LIBUNWIND_EXCEPTIONS
+# ifdef HAVE_LD_STATIC_DYNAMIC
+                           " %{!static:-Bstatic} -lunwind %{!static:-Bdynamic}"
+# else
                            " -lunwind"
+# endif
 #endif
                            );