--- /dev/null
+#!/bin/sh -e
+## 313_pr5025.dpatch
+##
+## DP: Description: Fix PR ld/5025
+## DP: Upstream status: CVS head 20070908
+
+if [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+
+ PR ld/5025
+ * emultempl/elf32.em (write_build_id_section): Correct test for
+ "missing" .note.gnu.build-id. Downgrade error to a warning if
+ it has been discarded.
+
+@DPATCH@
+Subject: Fix 5025, discarded .note.gnu.build-id
+
+Index: ld/emultempl/elf32.em
+===================================================================
+RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
+retrieving revision 1.186
+diff -u -p -r1.186 elf32.em
+--- ./ld/emultempl/elf32.em 17 Aug 2007 13:50:48 -0000 1.186
++++ ./ld/emultempl/elf32.em 15 Sep 2007 03:39:19 -0000
+@@ -936,10 +936,11 @@ gld${EMULATION_NAME}_write_build_id_sect
+ Elf_External_Note *e_note;
+
+ asec = info->sec;
+- if (asec->output_section == NULL)
++ if (bfd_is_abs_section (asec->output_section))
+ {
+- einfo (_("%P: .note.gnu.build-id section missing"));
+- return FALSE;
++ einfo (_("%P: warning: .note.gnu.build-id section discarded,"
++ " --build-id ignored.\n"));
++ return TRUE;
+ }
+ i_shdr = &elf_section_data (asec->output_section)->this_hdr;
+
+