OSDN Git Service

2004-12-15 H.J. Lu <hongjiu.lu@intel.com>
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 2004 23:50:26 +0000 (23:50 +0000)
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 2004 23:50:26 +0000 (23:50 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92229 138bc75d-0d04-0410-961f-82ee72b054a4

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

index b9160e3..1cdc056 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 daa0459..e3ae22b 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 00ce7c0..2c00052 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 3936aa4..e1d5a23 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 707ae33..27c3940 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
                            );