PR ld/11931
authorAlan Modra <amodra@gmail.com>
Fri, 10 Sep 2010 01:23:12 +0000 (01:23 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 10 Sep 2010 01:23:12 +0000 (01:23 +0000)
* ldlang.h (lang_for_each_statement_worker): Declare.
* ldlang.c (lang_for_each_statement_worker): Make global.  Don't
recurse into children of output_section_statement with constraint
set to -1.
(print_assignment): Handle NULL output_section->bfd_section.
(lang_size_sections_1): Ignore output section statement address
when constraint is -1.
* emultempl/xtensaelf.em (lang_for_each_statement_worker): Delete.

ld/ChangeLog
ld/emultempl/xtensaelf.em
ld/ldlang.c
ld/ldlang.h

index 95a6695f532bc9c0b1383134e8649509d3545b6b..ef96de51ad9d6dd9ebe7d849689b71447de515e2 100644 (file)
@@ -1,3 +1,15 @@
+2010-09-10  Alan Modra  <amodra@gmail.com>
+
+       PR ld/11931
+       * ldlang.h (lang_for_each_statement_worker): Declare.
+       * ldlang.c (lang_for_each_statement_worker): Make global.  Don't
+       recurse into children of output_section_statement with constraint
+       set to -1.
+       (print_assignment): Handle NULL output_section->bfd_section.
+       (lang_size_sections_1): Ignore output section statement address
+       when constraint is -1.
+       * emultempl/xtensaelf.em (lang_for_each_statement_worker): Delete.
+
 2010-09-09  Tristan Gingold  <gingold@adacore.com>
 
        * NEWS: Add a entry for alpha-vms.
index 37e7f5cb5d9df43b10eb5dfd497caacb416767db..38c4f0432b9a82f1118456d4211003d76c5ad7f7 100644 (file)
@@ -596,59 +596,6 @@ static size_t ld_count_children (lang_statement_union_type *);
 
 extern lang_statement_list_type constructor_list;
 
-/*  Begin verbatim code from ldlang.c:
-    the following are copied from ldlang.c because they are defined
-    there statically.  */
-
-static void
-lang_for_each_statement_worker (void (*func) (lang_statement_union_type *),
-                               lang_statement_union_type *s)
-{
-  for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
-    {
-      func (s);
-
-      switch (s->header.type)
-       {
-       case lang_constructors_statement_enum:
-         lang_for_each_statement_worker (func, constructor_list.head);
-         break;
-       case lang_output_section_statement_enum:
-         lang_for_each_statement_worker
-           (func,
-            s->output_section_statement.children.head);
-         break;
-       case lang_wild_statement_enum:
-         lang_for_each_statement_worker
-           (func,
-            s->wild_statement.children.head);
-         break;
-       case lang_group_statement_enum:
-         lang_for_each_statement_worker (func,
-                                         s->group_statement.children.head);
-         break;
-       case lang_data_statement_enum:
-       case lang_reloc_statement_enum:
-       case lang_object_symbols_statement_enum:
-       case lang_output_statement_enum:
-       case lang_target_statement_enum:
-       case lang_input_section_enum:
-       case lang_input_statement_enum:
-       case lang_assignment_statement_enum:
-       case lang_padding_statement_enum:
-       case lang_address_statement_enum:
-       case lang_fill_statement_enum:
-         break;
-       default:
-         FAIL ();
-         break;
-       }
-    }
-}
-
-/* End of verbatim code from ldlang.c.  */
-
-
 static reloc_deps_section *
 xtensa_get_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
                         asection *sec)
index 2b9971aff96e8b2f909118a610ec2dbf52dd0c24..7f444451309ef3de0599dfaefd9eb783b512e435 100644 (file)
@@ -871,9 +871,10 @@ walk_wild (lang_wild_statement_type *s, callback_t callback, void *data)
 }
 
 /* lang_for_each_statement walks the parse tree and calls the provided
-   function for each node.  */
+   function for each node, except those inside output section statements
+   with constraint set to -1.  */
 
-static void
+void
 lang_for_each_statement_worker (void (*func) (lang_statement_union_type *),
                                lang_statement_union_type *s)
 {
@@ -887,8 +888,9 @@ lang_for_each_statement_worker (void (*func) (lang_statement_union_type *),
          lang_for_each_statement_worker (func, constructor_list.head);
          break;
        case lang_output_section_statement_enum:
-         lang_for_each_statement_worker
-           (func, s->output_section_statement.children.head);
+         if (s->output_section_statement.constraint != -1)
+           lang_for_each_statement_worker
+             (func, s->output_section_statement.children.head);
          break;
        case lang_wild_statement_enum:
          lang_for_each_statement_worker (func,
@@ -3888,6 +3890,7 @@ print_assignment (lang_assignment_statement_type *assignment,
   bfd_boolean is_dot;
   bfd_boolean computation_is_valid = TRUE;
   etree_type *tree;
+  asection *osec;
 
   for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
     print_space ();
@@ -3907,7 +3910,10 @@ print_assignment (lang_assignment_statement_type *assignment,
       computation_is_valid = is_dot || (scan_for_self_assignment (dst, tree) == FALSE);
     }
 
-  exp_fold_tree (tree, output_section->bfd_section, &print_dot);
+  osec = output_section->bfd_section;
+  if (osec == NULL)
+    osec = bfd_abs_section_ptr;
+  exp_fold_tree (tree, osec, &print_dot);
   if (expld.result.valid_p)
     {
       bfd_vma value;
@@ -4704,6 +4710,9 @@ lang_size_sections_1
            lang_memory_region_type *r;
 
            os = &s->output_section_statement;
+           if (os->constraint == -1)
+             break;
+
            /* FIXME: We shouldn't need to zero section vmas for ld -r
               here, in lang_insert_orphan, or in the default linker scripts.
               This is covering for coff backend linker bugs.  See PR6945.  */
index 58d03f0167389a720ab973ef632eb7940c0e8882..e9bcacf9b404bf239bb541fa4fca3a3ca2c95dba 100644 (file)
@@ -580,6 +580,8 @@ extern void lang_add_reloc
    union etree_union *);
 extern void lang_for_each_statement
   (void (*) (lang_statement_union_type *));
+extern void lang_for_each_statement_worker
+  (void (*) (lang_statement_union_type *), lang_statement_union_type *);
 extern void *stat_alloc
   (size_t);
 extern void strip_excluded_output_sections
This page took 0.042048 seconds and 4 git commands to generate.