]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR ld/12726
authorAlan Modra <amodra@gmail.com>
Tue, 3 May 2011 14:56:14 +0000 (14:56 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 3 May 2011 14:56:14 +0000 (14:56 +0000)
* ldexp.h (lang_phase_type): Add lang_assigning_phase_enum.
* ldexp.c (exp_fold_tree_1): Correct assign to dot comment.  Don't
assign to dot when lang_assigning_phase_enum.
* ldlang.h (lang_do_assignments): Update prototype.
* ldlang.c (lang_do_assignments): Add phase parameter.  Update all
callers.
* pe-dll.c (pe_dll_fill_sections, pe_exe_fill_sections): Update
lang_do_assignments calls.

ld/ChangeLog
ld/ldexp.c
ld/ldexp.h
ld/ldlang.c
ld/ldlang.h
ld/pe-dll.c

index a9c5ee43608c96e077aff27645370be64921d0d0..6bf634998fe2d2c818d3ad4416161dc6424887ee 100644 (file)
@@ -1,3 +1,15 @@
+2011-05-04  Alan Modra  <amodra@gmail.com>
+
+       PR ld/12726
+       * ldexp.h (lang_phase_type): Add lang_assigning_phase_enum.
+       * ldexp.c (exp_fold_tree_1): Correct assign to dot comment.  Don't
+       assign to dot when lang_assigning_phase_enum.
+       * ldlang.h (lang_do_assignments): Update prototype.
+       * ldlang.c (lang_do_assignments): Add phase parameter.  Update all
+       callers.
+       * pe-dll.c (pe_dll_fill_sections, pe_exe_fill_sections): Update
+       lang_do_assignments calls.
+
 2011-04-28  Daniel C. Klauer  <daniel.c.klauer@web.de>
 
        PR ld/12614
index fc1860164844c4a2bbcee7e076fb7b8ca3e4150d..f70634c5c616bf935e8dd53d4eeee21160aa2dea 100644 (file)
@@ -783,12 +783,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.  */
index 6d98e756fdd3bb31a71b1cd2146b41b6dda05d96..4ea13c2c7b9010b116a3670a0d7e322f1843b157 100644 (file)
@@ -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;
 
index 2c07fa4d358c9344d644d76961a5d65b67b0bb91..c291fd9347671a5e132fd7d6431889dc59d5749c 100644 (file)
@@ -5606,8 +5606,9 @@ lang_do_assignments_1 (lang_statement_union_type *s,
 }
 
 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_layout)
 
              /* 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_layout)
   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);
     }
@@ -6666,8 +6667,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 ();
 
index db47af89640c2c5008a8a7aa7cabf3b379dc9097..d172c34f9c240ec953ef8000eb1a87a696d677e4 100644 (file)
@@ -543,7 +543,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;                                        \
index c8abf4df8a1bc774cd6b5cd040bff002f6db2f69..682ce46e65e600aec2da47f110c415f1e92e97a3 100644 (file)
@@ -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 <dj@cygnus.com>
 
    This file is part of the GNU Binutils.
@@ -3232,7 +3232,7 @@ pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
       ldemul_after_allocation ();
 
       /* Do the assignments again.  */
-      lang_do_assignments ();
+      lang_do_assignments (lang_final_phase_enum);
     }
 
   fill_edata (abfd, info);
@@ -3264,7 +3264,7 @@ pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info)
       ldemul_after_allocation ();
 
       /* Do the assignments again.  */
-      lang_do_assignments ();
+      lang_do_assignments (lang_final_phase_enum);
     }
   reloc_s->contents = reloc_d;
 }