diff options
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index beb84d3..f4eb703 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -236,9 +236,6 @@ walk_wild_consider_section (lang_wild_statement_type *ptr, { struct name_list *list_tmp; - /* Propagate the section_flag_info from the wild statement to the section. */ - s->section_flag_info = ptr->section_flag_list; - /* Don't process sections from files which were excluded. */ for (list_tmp = sec->spec.exclude_name_list; list_tmp; @@ -265,7 +262,7 @@ walk_wild_consider_section (lang_wild_statement_type *ptr, return; } - (*callback) (ptr, sec, s, file, data); + (*callback) (ptr, sec, s, ptr->section_flag_list, file, data); } /* Lowest common denominator routine that can handle everything correctly, @@ -284,7 +281,7 @@ walk_wild_section_general (lang_wild_statement_type *ptr, { sec = ptr->section_list; if (sec == NULL) - (*callback) (ptr, sec, s, file, data); + (*callback) (ptr, sec, s, ptr->section_flag_list, file, data); while (sec != NULL) { @@ -506,6 +503,7 @@ static void output_section_callback_fast (lang_wild_statement_type *ptr, struct wildcard_list *sec, asection *section, + struct flag_info *sflag_list ATTRIBUTE_UNUSED, lang_input_statement_type *file, void *output) { @@ -538,7 +536,7 @@ output_section_callback_tree_to_list (lang_wild_statement_type *ptr, if (tree->left) output_section_callback_tree_to_list (ptr, tree->left, output); - lang_add_section (&ptr->children, tree->section, + lang_add_section (&ptr->children, tree->section, NULL, (lang_output_section_statement_type *) output); if (tree->right) @@ -1809,7 +1807,7 @@ lang_insert_orphan (asection *s, if (add_child == NULL) add_child = &os->children; - lang_add_section (add_child, s, os); + lang_add_section (add_child, s, NULL, os); if (after && (s->flags & (SEC_LOAD | SEC_ALLOC)) != 0) { @@ -2227,16 +2225,15 @@ section_already_linked (bfd *abfd, asection *sec, void *data) foo.o(.text, .data). */ /* Add SECTION to the output section OUTPUT. Do this by creating a - lang_input_section statement which is placed at PTR. FILE is the - input file which holds SECTION. */ + lang_input_section statement which is placed at PTR. */ void lang_add_section (lang_statement_list_type *ptr, asection *section, + struct flag_info *sflag_info, lang_output_section_statement_type *output) { flagword flags = section->flags; - struct flag_info *sflag_info = section->section_flag_info; bfd_boolean discard; lang_input_section_type *new_section; @@ -2268,24 +2265,11 @@ lang_add_section (lang_statement_list_type *ptr, if (sflag_info) { - if (sflag_info->flags_initialized == FALSE) - bfd_lookup_section_flags (&link_info, sflag_info); - - if (sflag_info->only_with_flags != 0 - && sflag_info->not_with_flags != 0 - && ((sflag_info->not_with_flags & flags) != 0 - || (sflag_info->only_with_flags & flags) - != sflag_info->only_with_flags)) - return; + bfd_boolean keep; - if (sflag_info->only_with_flags != 0 - && (sflag_info->only_with_flags & flags) - != sflag_info->only_with_flags) - return; - - if (sflag_info->not_with_flags != 0 - && (sflag_info->not_with_flags & flags) != 0) - return; + keep = bfd_lookup_section_flags (&link_info, sflag_info, section); + if (!keep) + return; } if (section->output_section != NULL) @@ -2498,6 +2482,7 @@ static void output_section_callback (lang_wild_statement_type *ptr, struct wildcard_list *sec, asection *section, + struct flag_info *sflag_info, lang_input_statement_type *file, void *output) { @@ -2518,14 +2503,14 @@ output_section_callback (lang_wild_statement_type *ptr, of the current list. */ if (before == NULL) - lang_add_section (&ptr->children, section, os); + lang_add_section (&ptr->children, section, sflag_info, os); else { lang_statement_list_type list; lang_statement_union_type **pp; lang_list_init (&list); - lang_add_section (&list, section, os); + lang_add_section (&list, section, sflag_info, os); /* If we are discarding the section, LIST.HEAD will be NULL. */ @@ -2551,6 +2536,7 @@ static void check_section_callback (lang_wild_statement_type *ptr ATTRIBUTE_UNUSED, struct wildcard_list *sec ATTRIBUTE_UNUSED, asection *section, + struct flag_info *sflag_info ATTRIBUTE_UNUSED, lang_input_statement_type *file ATTRIBUTE_UNUSED, void *output) { @@ -6010,7 +5996,7 @@ lang_place_orphans (void) = lang_output_section_statement_lookup (".bss", 0, TRUE); lang_add_section (&default_common_section->children, s, - default_common_section); + NULL, default_common_section); } } else @@ -6032,7 +6018,7 @@ lang_place_orphans (void) && (link_info.relocatable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)) os->addr_tree = exp_intop (0); - lang_add_section (&os->children, s, os); + lang_add_section (&os->children, s, NULL, os); } } } @@ -6253,6 +6239,7 @@ static void gc_section_callback (lang_wild_statement_type *ptr, struct wildcard_list *sec ATTRIBUTE_UNUSED, asection *section, + struct flag_info *sflag_info ATTRIBUTE_UNUSED, lang_input_statement_type *file ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED) { @@ -6324,6 +6311,7 @@ static void find_relro_section_callback (lang_wild_statement_type *ptr ATTRIBUTE_UNUSED, struct wildcard_list *sec ATTRIBUTE_UNUSED, asection *section, + struct flag_info *sflag_info ATTRIBUTE_UNUSED, lang_input_statement_type *file ATTRIBUTE_UNUSED, void *data) { |