[binutils/f15] Add check for dynamic sections misrepresented as notes. (BZ 712166)

Nicholas Clifton nickc at fedoraproject.org
Fri Jun 10 14:55:35 UTC 2011


commit 046f0bc1900e489852779df498813c9b6cd82946
Author: Nick Clifton <nickc at redhat.com>
Date:   Fri Jun 10 15:55:52 2011 +0100

    Add check for dynamic sections misrepresented as notes.  (BZ 712166)

 binutils-2.21.51.0.6-dynamic-notes.patch |   35 ++++++++++++++++++++++++++++++
 binutils.spec                            |    7 +++++-
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/binutils-2.21.51.0.6-dynamic-notes.patch b/binutils-2.21.51.0.6-dynamic-notes.patch
new file mode 100644
index 0000000..967e789
--- /dev/null
+++ b/binutils-2.21.51.0.6-dynamic-notes.patch
@@ -0,0 +1,35 @@
+*** ../binutils-2.21.51.0.6.orig/bfd/elflink.c	2011-06-10 15:25:42.114479018 +0100
+--- bfd/elflink.c	2011-06-10 15:41:05.971479137 +0100
+*************** bfd_elf_final_link (bfd *abfd, struct bf
+*** 11156,11161 ****
+--- 11156,11168 ----
+  		    (_("%B: could not find output section %s"), abfd, name);
+  		  goto error_return;
+  		}
++ 	      if (elf_section_data (o->output_section)->this_hdr.sh_type == SHT_NOTE)
++ 		{
++ 		  (*_bfd_error_handler)
++ 		    (_("warning: section '%s' is being made into a note"), name);
++ 		  bfd_set_error (bfd_error_nonrepresentable_section);
++ 		  goto error_return;
++ 		}
+  	      dyn.d_un.d_ptr = o->vma;
+  	      break;
+  
+*************** bfd_elf_final_link (bfd *abfd, struct bf
+*** 11243,11249 ****
+  	    continue;
+  	  if ((elf_section_data (o->output_section)->this_hdr.sh_type
+  	       != SHT_STRTAB)
+! 	      || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
+  	    {
+  	      /* FIXME: octets_per_byte.  */
+  	      if (! bfd_set_section_contents (abfd, o->output_section,
+--- 11250,11256 ----
+  	    continue;
+  	  if ((elf_section_data (o->output_section)->this_hdr.sh_type
+  	       != SHT_STRTAB)
+! 	      && strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
+  	    {
+  	      /* FIXME: octets_per_byte.  */
+  	      if (! bfd_set_section_contents (abfd, o->output_section,
diff --git a/binutils.spec b/binutils.spec
index e1dd3ca..2f6f2fe 100644
--- a/binutils.spec
+++ b/binutils.spec
@@ -17,7 +17,7 @@
 Summary: A GNU collection of binary utilities
 Name: %{?cross}binutils%{?_with_debug:-debug}
 Version: 2.21.51.0.6
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv3+
 Group: Development/Tools
 URL: http://sources.redhat.com/binutils
@@ -31,6 +31,7 @@ Patch05: binutils-2.20.51.0.2-set-long-long.patch
 Patch06: binutils-2.20.51.0.10-copy-osabi.patch
 Patch07: binutils-2.20.51.0.10-sec-merge-emit.patch
 Patch08: binutils-2.20.51.0.2-build-id.patch
+Patch09: binutils-2.21.51.0.6-dynamic-notes.patch
 
 %define gold_arches %ix86 x86_64
 
@@ -129,6 +130,7 @@ using libelf instead of BFD.
 %patch06 -p0 -b .copy-osabi~
 %patch07 -p0 -b .sec-merge-emit~
 %patch08 -p0 -b .build-id~
+%patch09 -p0 -b .dynamic-notes~
 
 # We cannot run autotools as there is an exact requirement of autoconf-2.59.
 
@@ -418,6 +420,9 @@ exit 0
 %endif # %{isnative}
 
 %changelog
+* Fri Jun  10 2011 Nick Clifton <nickc at redhat.com> - 2.21.51.0.6-4
+- Add check for dynamic sections misrepresented as notes.  (BZ 712166)
+
 * Fri May  27 2011 Peter Robinson <pbrobinson at gmail.com> - 2.21.51.0.6-3
 - Configure with --enable-plugins.  (BZ 682852)
 


More information about the scm-commits mailing list