]> 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>
Wed, 15 Dec 2004 23:50:26 +0000 (23:50 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Wed, 15 Dec 2004 23:50:26 +0000 (15:50 -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: r92229

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

index b9160e387d13c54d252ca857f2cf742c7bcd3289..1cdc056bd6c6e0d8f7850074160457fa97a6adea 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  Daniel Berlin  <dberlin@dberlin.org>
        
        * cfgloop.c (flow_loops_dump): Don't print out levels.
index daa0459c4e421367c5e290d37058d84e8aee0965..e3ae22b18bfc20db0c691dbc0758c5bd67c783eb 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 00ce7c03a12969368660f94bdc84a1ddcc81db1f..2c000521f372947f42fc27b57296422c68054a02 100755 (executable)
 
 # Target-specific assembler checks.
 
+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
+
 if test x"$demangler_in_ld" = xyes; then
   echo "$as_me:$LINENO: checking linker --demangle support" >&5
 echo $ECHO_N "checking linker --demangle support... $ECHO_C" >&6
index 3936aa4e34b75d20a2591f8555c53e5237f160b8..e1d5a23dc5c011ac55be712d776dbb170deaa7ee 100644 (file)
@@ -2518,6 +2518,25 @@ fi
 
 # Target-specific assembler checks.
 
+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)
+
 if test x"$demangler_in_ld" = xyes; then
   AC_MSG_CHECKING(linker --demangle support)
   gcc_cv_ld_demangle=no
index 707ae338efe0102a7e41cf43546cd10be20dc14b..27c394099bda54fb4974114eb0a47feb508b7f56 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1715,7 +1715,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
                            );