iter_stack_update (stack_p);
}
- lang_for_each_statement_worker (xtensa_ldlang_clear_addresses, statement);
+ lang_for_each_statement_worker (xtensa_ldlang_clear_addresses,
+ statement, true);
}
{
input_section_found = false;
input_section_target = sec;
- lang_for_each_statement_worker (input_section_linked_worker, stat_ptr->head);
+ lang_for_each_statement_worker (input_section_linked_worker,
+ stat_ptr->head, true);
return input_section_found;
}
static void
xtensa_wild_group_interleave (lang_statement_union_type *s)
{
- lang_for_each_statement_worker (xtensa_wild_group_interleave_callback, s);
+ lang_for_each_statement_worker (xtensa_wild_group_interleave_callback,
+ s, true);
}
ld_xtensa_insert_page_offsets (0, statement, deps,
xtensa_use_literal_pages);
lang_for_each_statement_worker (xtensa_ldlang_clear_addresses,
- statement);
+ statement, true);
}
/* Clean up. */
static void
xtensa_colocate_output_literals (lang_statement_union_type *s)
{
- lang_for_each_statement_worker (xtensa_colocate_output_literals_callback, s);
+ lang_for_each_statement_worker (xtensa_colocate_output_literals_callback,
+ s, true);
}
/* We always have a root node in the prefix tree. It corresponds to the
empty prefix. E.g. a glob like "*" would sit in this root. */
-static struct prefixtree the_root, *ptroot = &the_root;
+static struct prefixtree ptroot;
/* Given a prefix tree in *TREE, corresponding to prefix P, find or
INSERT the tree node corresponding to prefix P+C. */
{
/* If we have no section_list (no wildcards in the wild STMT),
then every section name will match, so add this to the root. */
- pt_add_stmt (ptroot, stmt);
+ pt_add_stmt (&ptroot, stmt);
return;
}
{
const char *name = sec->spec.name ? sec->spec.name : "*";
char c;
- t = ptroot;
+ t = &ptroot;
for (; (c = *name); name++)
{
if (c == '*' || c == '[' || c == '?')
static void
debug_prefix_tree (void)
{
- debug_prefix_tree_rec (ptroot, 2);
+ debug_prefix_tree_rec (&ptroot, 2);
}
/* Like strcspn() but start to look from the end to beginning of
{
const char *sname = bfd_section_name (s);
char c = 1;
- struct prefixtree *t = ptroot;
+ struct prefixtree *t = &ptroot;
//printf (" YYY consider %s of %s\n", sname, file->the_bfd->filename);
do
{
static void
resolve_wilds (void)
{
+ obstack_init (&matching_obstack);
LANG_FOR_EACH_INPUT_STATEMENT (f)
{
//printf("XXX %s\n", f->filename);
/* lang_for_each_statement walks the parse tree and calls the provided
function for each node, except those inside output section statements
- with constraint set to -1. */
+ with constraint set to -1 if CONSTRAINED is true. */
void
lang_for_each_statement_worker (void (*func) (lang_statement_union_type *),
- lang_statement_union_type *s)
+ lang_statement_union_type *s,
+ bool constrained)
{
for (; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
case lang_constructors_statement_enum:
- lang_for_each_statement_worker (func, constructor_list.head);
+ lang_for_each_statement_worker (func, constructor_list.head,
+ constrained);
break;
case lang_output_section_statement_enum:
- if (s->output_section_statement.constraint != -1)
+ if (!constrained || s->output_section_statement.constraint != -1)
lang_for_each_statement_worker
- (func, s->output_section_statement.children.head);
+ (func, s->output_section_statement.children.head, constrained);
break;
case lang_wild_statement_enum:
lang_for_each_statement_worker (func,
- s->wild_statement.children.head);
+ s->wild_statement.children.head,
+ constrained);
break;
case lang_group_statement_enum:
lang_for_each_statement_worker (func,
- s->group_statement.children.head);
+ s->group_statement.children.head,
+ constrained);
break;
case lang_data_statement_enum:
case lang_reloc_statement_enum:
{
obstack_begin (&stat_obstack, 1000);
obstack_init (&pt_obstack);
- obstack_init (&matching_obstack);
}
stat_ptr = &statement_list;
static void
reset_resolved_wilds (void)
{
- lang_for_each_statement (reset_one_wild);
+ lang_for_each_statement_worker (reset_one_wild, statement_list.head, false);
obstack_free (&matching_obstack, NULL);
- obstack_init (&matching_obstack);
}
/* For each output section statement, splice any entries on the