From 3e3ce188a7255121ab4934880442840323addc63 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Jun 24 2011 10:46:17 +0000 Subject: Import fix for PR ld/12921. --- diff --git a/binutils-2.21.52.0.1-sh_offset-for-SHT_NOBITS.patch b/binutils-2.21.52.0.1-sh_offset-for-SHT_NOBITS.patch new file mode 100644 index 0000000..100828b --- /dev/null +++ b/binutils-2.21.52.0.1-sh_offset-for-SHT_NOBITS.patch @@ -0,0 +1,55 @@ +*** ../binutils-2.21.52.0.1.orig/bfd/elf.c 2011-06-24 11:21:17.380536999 +0100 +--- bfd/elf.c 2011-06-24 11:27:44.781536999 +0100 +*************** assign_file_positions_for_load_sections +*** 4803,4826 **** + } + else + { +! if (p->p_type == PT_LOAD +! || (this_hdr->sh_type == SHT_NOBITS +! && (this_hdr->sh_flags & SHF_TLS) != 0 +! && this_hdr->sh_offset == 0)) + { +! if (this_hdr->sh_type == SHT_NOBITS) +! { +! /* These sections don't really need sh_offset, +! but give them one anyway. */ +! bfd_vma adjust = vma_page_aligned_bias (this_hdr->sh_addr, +! off, align); +! this_hdr->sh_offset = sec->filepos = off + adjust; +! } +! else +! { +! this_hdr->sh_offset = sec->filepos = off; +! off += this_hdr->sh_size; +! } + } + + if (this_hdr->sh_type != SHT_NOBITS) +--- 4803,4828 ---- + } + else + { +! if (p->p_type == PT_LOAD) + { +! this_hdr->sh_offset = sec->filepos = off; +! if (this_hdr->sh_type != SHT_NOBITS) +! off += this_hdr->sh_size; +! } +! else if (this_hdr->sh_type == SHT_NOBITS +! && (this_hdr->sh_flags & SHF_TLS) != 0 +! && this_hdr->sh_offset == 0) +! { +! /* This is a .tbss section that didn't get a PT_LOAD. +! (See _bfd_elf_map_sections_to_segments "Create a +! final PT_LOAD".) Set sh_offset to the value it +! would have if we had created a zero p_filesz and +! p_memsz PT_LOAD header for the section. This +! also makes the PT_TLS header have the same +! p_offset value. */ +! bfd_vma adjust = vma_page_aligned_bias (this_hdr->sh_addr, +! off, align); +! this_hdr->sh_offset = sec->filepos = off + adjust; + } + + if (this_hdr->sh_type != SHT_NOBITS) diff --git a/binutils.spec b/binutils.spec index c30ba27..7797a41 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.52.0.1 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ Group: Development/Tools URL: http://sources.redhat.com/binutils @@ -33,6 +33,7 @@ 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.52.0.1-keeping-notes.patch Patch10: binutils-2.21.52.0.1-finding-without-symbols.patch +Patch11: binutils-2.21.52.0.1-sh_offset-for-SHT_NOBITS.patch %define gold_arches %ix86 x86_64 @@ -133,6 +134,7 @@ using libelf instead of BFD. %patch08 -p0 -b .build-id~ %patch09 -p0 -b .keeping-notes~ %patch10 -p0 -b .finding~ +%patch11 -p0 -b .sh_offset~ # We cannot run autotools as there is an exact requirement of autoconf-2.59. @@ -422,6 +424,9 @@ exit 0 %endif # %{isnative} %changelog +* Fri Jun 24 2011 Nick Clifton - 2.21.52.0.1-5 +- Import fix for PR ld/12921. + * Fri Jun 24 2011 Nick Clifton - 2.21.52.0.1-4 - Run "alternatives --auto" to restore ld symbolic link if it was manually configured. (BZ 661247)