2007-07-22  Roland McGrath  <roland@redhat.com>

	* config/rs6000/sysv4.h (LINK_EH_SPEC): Add --build-id for
	non-relocatable link.
	* config/linux.h (LINK_EH_SPEC): Likewise.
	* config/sparc/linux.h (LINK_EH_SPEC): Likewise.
	* config/sparc/linux64.h (LINK_EH_SPEC): Likewise.
	* config/alpha/elf.h (LINK_EH_SPEC): Likewise.
	* config/ia64/linux.h (LINK_EH_SPEC): Likewise.

--- gcc/config/rs6000/sysv4.h.~1~
+++ gcc/config/rs6000/sysv4.h
@@ -1044,7 +1044,7 @@ extern int fixuplabelno;
   %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
 #endif
 
 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
--- gcc/config/linux.h.~1~
+++ gcc/config/linux.h
@@ -85,7 +85,7 @@ Boston, MA 02110-1301, USA.  */
     } while (0)
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
 #endif
 
 /* Define this so we can compile MS code for use with WINE.  */
--- gcc/config/sparc/linux64.h.~1~
+++ gcc/config/sparc/linux64.h
@@ -316,7 +316,7 @@ do {									\
 #define DITF_CONVERSION_LIBFUNCS 1
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
 #endif
 
 #ifdef HAVE_AS_TLS
--- gcc/config/sparc/linux.h.~1~
+++ gcc/config/sparc/linux.h
@@ -188,7 +188,7 @@ do {									\
 #define DITF_CONVERSION_LIBFUNCS 1
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
 #endif
 
 #ifdef HAVE_AS_TLS
--- gcc/config/alpha/elf.h.~1~
+++ gcc/config/alpha/elf.h
@@ -453,5 +453,5 @@ extern int alpha_this_gpdisp_sequence_nu
    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 "%{!static:--eh-frame-hdr} %{!r:--build-id} "
 #endif
--- gcc/config/ia64/linux.h.~1~
+++ gcc/config/ia64/linux.h
@@ -56,7 +56,7 @@ do {						\
    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 "%{!r:--build-id} "
 
 #define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h"
 
