diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2017-07-28 13:01:10 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-07-28 13:01:10 +0100 |
commit | 2b94abd48aef2d91bae1c35c8c10ebfb8757247d (patch) | |
tree | 6d1abfbf1470194ed0473dedbc483adee48644e5 /ld/ldlang.c | |
parent | a808670465869100d4178a572da8a1503d727f3b (diff) | |
download | gdb-2b94abd48aef2d91bae1c35c8c10ebfb8757247d.zip gdb-2b94abd48aef2d91bae1c35c8c10ebfb8757247d.tar.gz gdb-2b94abd48aef2d91bae1c35c8c10ebfb8757247d.tar.bz2 |
Make some improvements to how SORT_* specifiers and EXCLUDE_FILE specifiers are handled in the linker script grammar.
* ldgram.y (ldgram_had_keep): Make static.
(ldgram_vers_current_lang): Likewise.
(filename_spec): New rule.
(input_section_spec_no_keep): Use filename_spec.
(wildcard_maybe_exclude): New rule.
(wildcard_spec): Rename to...
(section_name_spec): ...this.
(section_NAME_list): Rename to...
(section_name_list): ...this.
(section_name_spec): Simplifiy and use wildcard_maybe_exclude.
* ldlang.c (placed_commons): Delete.
(lang_add_wild): No longer set placed_commons.
(print_wild_statement): Use full names for SORT specifiers.
* testsuite/ld-scripts/align.exp: Run new tests.
* testsuite/ld-scripts/align3.d: New file.
* testsuite/ld-scripts/align3.t: New file.
* testsuite/ld-scripts/align4.d: New file.
* testsuite/ld-scripts/align4.t: New file.
* testsuite/ld-scripts/align5.d: New file.
* testsuite/ld-scripts/align5.t: New file.
* testsuite/ld-scripts/exclude-file-5.d: New file.
* testsuite/ld-scripts/exclude-file-5.map: New file.
* testsuite/ld-scripts/exclude-file-5.t: New file.
* testsuite/ld-scripts/exclude-file-6.d: New file.
* testsuite/ld-scripts/exclude-file-6.map: New file.
* testsuite/ld-scripts/exclude-file-6.t: New file.
* NEWS: Mention the changes.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 726bc8e..b8b214d 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -61,7 +61,6 @@ static struct obstack map_obstack; #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free static const char *entry_symbol_default = "start"; -static bfd_boolean placed_commons = FALSE; static bfd_boolean map_head_is_link_order = FALSE; static lang_output_section_statement_type *default_common_section; static bfd_boolean map_option_f; @@ -4414,7 +4413,7 @@ print_wild_statement (lang_wild_statement_type *w, } if (w->filenames_sorted) - minfo ("SORT("); + minfo ("SORT_BY_NAME("); if (w->filename != NULL) minfo ("%s", w->filename); else @@ -4425,8 +4424,44 @@ print_wild_statement (lang_wild_statement_type *w, minfo ("("); for (sec = w->section_list; sec; sec = sec->next) { - if (sec->spec.sorted) - minfo ("SORT("); + int closing_paren = 0; + + switch (sec->spec.sorted) + { + case none: + break; + + case by_name: + minfo ("SORT_BY_NAME("); + closing_paren = 1; + break; + + case by_alignment: + minfo ("SORT_BY_ALIGNMENT("); + closing_paren = 1; + break; + + case by_name_alignment: + minfo ("SORT_BY_NAME(SORT_BY_ALIGNMENT("); + closing_paren = 2; + break; + + case by_alignment_name: + minfo ("SORT_BY_ALIGNMENT(SORT_BY_NAME("); + closing_paren = 2; + break; + + case by_none: + minfo ("SORT_NONE("); + closing_paren = 1; + break; + + case by_init_priority: + minfo ("SORT_BY_INIT_PRIORITY("); + closing_paren = 1; + break; + } + if (sec->spec.exclude_name_list != NULL) { name_list *tmp; @@ -4439,8 +4474,8 @@ print_wild_statement (lang_wild_statement_type *w, minfo ("%s", sec->spec.name); else minfo ("*"); - if (sec->spec.sorted) - minfo (")"); + for (;closing_paren > 0; closing_paren--) + minfo (")"); if (sec->next) minfo (" "); } @@ -7238,9 +7273,6 @@ lang_add_wild (struct wildcard_spec *filespec, curr != NULL; section_list = curr, curr = next) { - if (curr->spec.name != NULL && strcmp (curr->spec.name, "COMMON") == 0) - placed_commons = TRUE; - next = curr->next; curr->next = section_list; } |