From f466cc5c3314601d662b13f886a3d8b2eab0f985 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Jul 12 2011 14:48:51 +0000 Subject: Import patch for PR ld/12726. (BZ 719733) --- diff --git a/binutils-2.21.51.0.6-assign-to-dot.patch b/binutils-2.21.51.0.6-assign-to-dot.patch new file mode 100644 index 0000000..3a65d34 --- /dev/null +++ b/binutils-2.21.51.0.6-assign-to-dot.patch @@ -0,0 +1,115 @@ +diff -rup binutils-2.21.51.0.6/ld/ldexp.c binutils-2.21.51.0.6.new/ld/ldexp.c +--- binutils-2.21.51.0.6/ld/ldexp.c 2011-01-18 23:29:28.000000000 +0000 ++++ binutils-2.21.51.0.6.new/ld/ldexp.c 2011-07-12 13:52:47.140984706 +0100 +@@ -752,12 +752,15 @@ exp_fold_tree_1 (etree_type *tree) + case etree_provided: + if (tree->assign.dst[0] == '.' && tree->assign.dst[1] == 0) + { +- /* Assignment to dot can only be done during allocation. */ + if (tree->type.node_class != etree_assign) + einfo (_("%F%S can not PROVIDE assignment to location counter\n")); ++ /* After allocation, assignment to dot should not be done inside ++ an output section since allocation adds a padding statement ++ that effectively duplicates the assignment. */ + if (expld.phase == lang_mark_phase_enum + || expld.phase == lang_allocating_phase_enum +- || (expld.phase == lang_final_phase_enum ++ || ((expld.phase == lang_assigning_phase_enum ++ || expld.phase == lang_final_phase_enum) + && expld.section == bfd_abs_section_ptr)) + { + /* Notify the folder that this is an assignment to dot. */ +diff -rup binutils-2.21.51.0.6/ld/ldexp.h binutils-2.21.51.0.6.new/ld/ldexp.h +--- binutils-2.21.51.0.6/ld/ldexp.h 2011-01-18 23:29:28.000000000 +0000 ++++ binutils-2.21.51.0.6.new/ld/ldexp.h 2011-07-12 13:52:49.804972646 +0100 +@@ -97,6 +97,7 @@ typedef enum { + lang_first_phase_enum, + lang_mark_phase_enum, + lang_allocating_phase_enum, ++ lang_assigning_phase_enum, + lang_final_phase_enum + } lang_phase_type; + +diff -rup binutils-2.21.51.0.6/ld/ldlang.c binutils-2.21.51.0.6.new/ld/ldlang.c +--- binutils-2.21.51.0.6/ld/ldlang.c 2011-01-18 23:30:00.000000000 +0000 ++++ binutils-2.21.51.0.6.new/ld/ldlang.c 2011-07-12 13:52:53.893954137 +0100 +@@ -5610,8 +5610,9 @@ lang_do_assignments_1 (lang_statement_un + } + + void +-lang_do_assignments (void) ++lang_do_assignments (lang_phase_type phase) + { ++ expld.phase = phase; + lang_statement_iteration++; + lang_do_assignments_1 (statement_list.head, abs_output_section, NULL, 0); + } +@@ -6403,7 +6404,7 @@ lang_relax_sections (bfd_boolean need_la + + /* Do all the assignments with our current guesses as to + section sizes. */ +- lang_do_assignments (); ++ lang_do_assignments (lang_assigning_phase_enum); + + /* We must do this after lang_do_assignments, because it uses + size. */ +@@ -6424,7 +6425,7 @@ lang_relax_sections (bfd_boolean need_la + if (need_layout) + { + /* Final extra sizing to report errors. */ +- lang_do_assignments (); ++ lang_do_assignments (lang_assigning_phase_enum); + lang_reset_memory_regions (); + lang_size_sections (NULL, TRUE); + } +@@ -6652,8 +6653,7 @@ lang_process (void) + + /* Do all the assignments, now that we know the final resting places + of all the symbols. */ +- expld.phase = lang_final_phase_enum; +- lang_do_assignments (); ++ lang_do_assignments (lang_final_phase_enum); + + ldemul_finish (); + +diff -rup binutils-2.21.51.0.6/ld/ldlang.h binutils-2.21.51.0.6.new/ld/ldlang.h +--- binutils-2.21.51.0.6/ld/ldlang.h 2011-01-18 23:30:00.000000000 +0000 ++++ binutils-2.21.51.0.6.new/ld/ldlang.h 2011-07-12 13:52:56.592941924 +0100 +@@ -541,7 +541,7 @@ extern void lang_for_each_file + extern void lang_reset_memory_regions + (void); + extern void lang_do_assignments +- (void); ++ (lang_phase_type); + + #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \ + lang_input_statement_type *statement; \ +diff -rup binutils-2.21.51.0.6/ld/pe-dll.c binutils-2.21.51.0.6.new/ld/pe-dll.c +--- binutils-2.21.51.0.6/ld/pe-dll.c 2010-07-09 20:35:52.000000000 +0100 ++++ binutils-2.21.51.0.6.new/ld/pe-dll.c 2011-07-12 13:53:00.596923809 +0100 +@@ -1,6 +1,6 @@ + /* Routines to help build PEI-format DLLs (Win32 etc) + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +- 2008, 2009, 2010 Free Software Foundation, Inc. ++ 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Written by DJ Delorie + + This file is part of the GNU Binutils. +@@ -3226,7 +3226,7 @@ pe_dll_fill_sections (bfd *abfd, struct + ldemul_after_allocation (); + + /* Do the assignments again. */ +- lang_do_assignments (); ++ lang_do_assignments (lang_final_phase_enum); + } + + fill_edata (abfd, info); +@@ -3258,7 +3258,7 @@ pe_exe_fill_sections (bfd *abfd, struct + ldemul_after_allocation (); + + /* Do the assignments again. */ +- lang_do_assignments (); ++ lang_do_assignments (lang_final_phase_enum); + } + reloc_s->contents = reloc_d; + } diff --git a/binutils.spec b/binutils.spec index 2f6f2fe..faf5558 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: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ Group: Development/Tools URL: http://sources.redhat.com/binutils @@ -32,6 +32,7 @@ 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 +Patch10: binutils-2.21.51.0.6-assign-to-dot.patch %define gold_arches %ix86 x86_64 @@ -131,6 +132,7 @@ using libelf instead of BFD. %patch07 -p0 -b .sec-merge-emit~ %patch08 -p0 -b .build-id~ %patch09 -p0 -b .dynamic-notes~ +%patch10 -p1 -b .dot-assign~ # We cannot run autotools as there is an exact requirement of autoconf-2.59. @@ -420,6 +422,9 @@ exit 0 %endif # %{isnative} %changelog +* Tue Jul 12 2011 Nick Clifton - 2.21.51.0.6-5 +- import patch for PR ld/12726. (BZ 719733) + * Fri Jun 10 2011 Nick Clifton - 2.21.51.0.6-4 - Add check for dynamic sections misrepresented as notes. (BZ 712166)