# DP: On linux targets pass --no-add-needed to the linker.

2010-02-08  Roland McGrath  <roland@redhat.com>

	* config/rs6000/sysv4.h (LINK_EH_SPEC): Pass --no-add-needed to the
	linker.
	* config/linux.h (LINK_EH_SPEC): Likewise.
	* config/alpha/elf.h (LINK_EH_SPEC): Likewise.
	* config/ia64/linux.h (LINK_EH_SPEC): Likewise.

--- a/src/gcc/config/rs6000/sysv4.h
+++ b/src/gcc/config/rs6000/sysv4.h
@@ -836,7 +836,7 @@
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
 # undef  LINK_EH_SPEC
-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+# define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
 #endif
 
 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
--- a/src/gcc/config/gnu-user.h
+++ b/src/gcc/config/gnu-user.h
@@ -82,7 +82,9 @@
 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
+#else
+#define LINK_EH_SPEC "--no-add-needed "
 #endif
 
 #undef LINK_GCC_C_SEQUENCE_SPEC
--- a/src/gcc/config/alpha/elf.h
+++ b/src/gcc/config/alpha/elf.h
@@ -438,7 +438,7 @@
    I imagine that other systems will catch up.  In the meantime, it
    doesn't harm to make sure that the data exists to be used later.  */
 #if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
 #endif
 
 /* A C statement (sans semicolon) to output to the stdio stream STREAM
--- a/src/gcc/config/ia64/linux.h
+++ b/src/gcc/config/ia64/linux.h
@@ -82,7 +82,7 @@
    Signalize that because we have fde-glibc, we don't need all C shared libs
    linked against -lgcc_s.  */
 #undef LINK_EH_SPEC
-#define LINK_EH_SPEC ""
+#define LINK_EH_SPEC "--no-add-needed "
 
 #define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h"
 
