diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2004-10-04 16:45:51 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2004-10-04 16:45:51 +0000 |
commit | bcaa7b3eb9571ac0699402a62bf1bfae3a263413 (patch) | |
tree | a3101f1a003e9bb9ff9579fc1a0c3d016cc52821 /ld/ldgram.y | |
parent | a4f5ad884ecd1b56c973e0d562d97720140d1ec8 (diff) | |
download | gdb-bcaa7b3eb9571ac0699402a62bf1bfae3a263413.zip gdb-bcaa7b3eb9571ac0699402a62bf1bfae3a263413.tar.gz gdb-bcaa7b3eb9571ac0699402a62bf1bfae3a263413.tar.bz2 |
ld/
2004-10-04 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention SORT_BY_NAME, SORT_BY_ALIGNMENT and
--sort-section name|alignment.
* ld.texinfo: Document SORT_BY_NAME, SORT_BY_ALIGNMENT and
--sort-section name|alignment.
* ld.h (sort_type): New enum.
(wildcard_spec): Change the type of `sorted' to sort_type.
* ldgram.y (SORT): Removed.
(SORT_BY_NAME): Added.
(SORT_BY_ALIGNMENT): Added.
(wildcard_spec): Updated `sorted'. Handle SORT_BY_NAME and
SORT_BY_ALIGNMENT.
(input_section_spec_no_keep): Updated `sorted'.
(statement): Replace SORT with SORT_BY_NAME.
* ldlang.c (compare_section): New function to compare 2
sections with different sorting schemes.
(wild_sort): Updated. Use compare_section.
(update_wild_statements): New function.
(lang_process): Call update_wild_statements before
map_input_to_output_sections.
* ldlex.l (SORT_BY_NAME): New.
(SORT_BY_ALIGNMENT): New.
(SORT): Return SORT_BY_NAME.
* ldmain.c (sort_section): New. Defined.
(main): Initialize it to none.
* lexsup.c (option_values): Add OPTION_SORT_SECTION.
(ld_options): Add an entry for OPTION_SORT_SECTION.
(parse_args): Handle OPTION_SORT_SECTION.
* mri.c (mri_draw_tree): Updated `sorted'.
ld/testsuite/
2004-10-04 H.J. Lu <hongjiu.lu@intel.com>
* ld-scripts/sort.exp: New file for section sorting tests.
* ld-scripts/sort_b_a.d: Likewise
* ld-scripts/sort_b_a.s: Likewise
* ld-scripts/sort_b_a.t: Likewise
* ld-scripts/sort_b_a_a-1.d: Likewise
* ld-scripts/sort_b_a_a-2.d: Likewise
* ld-scripts/sort_b_a_a-3.d: Likewise
* ld-scripts/sort_b_a_a.t: Likewise
* ld-scripts/sort_b_a_n-1.d: Likewise
* ld-scripts/sort_b_a_n-2.d: Likewise
* ld-scripts/sort_b_a_n-3.d: Likewise
* ld-scripts/sort_b_a_n.t: Likewise
* ld-scripts/sort_b_n.d: Likewise
* ld-scripts/sort_b_n.s: Likewise
* ld-scripts/sort_b_n.t: Likewise
* ld-scripts/sort_b_n_a-1.d: Likewise
* ld-scripts/sort_b_n_a-2.d: Likewise
* ld-scripts/sort_b_n_a-3.d: Likewise
* ld-scripts/sort_b_n_a.t: Likewise
* ld-scripts/sort_b_n_n-1.d: Likewise
* ld-scripts/sort_b_n_n-2.d: Likewise
* ld-scripts/sort_b_n_n-3.d: Likewise
* ld-scripts/sort_b_n_n.t: Likewise
* ld-scripts/sort_n_a-a.s: Likewise
* ld-scripts/sort_n_a-b.s: Likewise
* ld-scripts/sort_no-1.d: Likewise
* ld-scripts/sort_no-2.d: Likewise
* ld-scripts/sort_no.t: Likewise
Diffstat (limited to 'ld/ldgram.y')
-rw-r--r-- | ld/ldgram.y | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/ld/ldgram.y b/ld/ldgram.y index f4f4589..bdfdcd5 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -128,7 +128,8 @@ static int error_index; %token END %left <token> '(' %token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE -%token SECTIONS PHDRS SORT DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END +%token SECTIONS PHDRS DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END +%token SORT_BY_NAME SORT_BY_ALIGNMENT %token '{' '}' %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH %token INHIBIT_COMMON_ALLOCATION @@ -412,25 +413,55 @@ wildcard_spec: wildcard_name { $$.name = $1; - $$.sorted = FALSE; + $$.sorted = none; $$.exclude_name_list = NULL; } | EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name { $$.name = $5; - $$.sorted = FALSE; + $$.sorted = none; $$.exclude_name_list = $3; } - | SORT '(' wildcard_name ')' + | SORT_BY_NAME '(' wildcard_name ')' { $$.name = $3; - $$.sorted = TRUE; + $$.sorted = by_name; $$.exclude_name_list = NULL; } - | SORT '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')' + | SORT_BY_ALIGNMENT '(' wildcard_name ')' + { + $$.name = $3; + $$.sorted = by_alignment; + $$.exclude_name_list = NULL; + } + | SORT_BY_NAME '(' SORT_BY_ALIGNMENT '(' wildcard_name ')' ')' + { + $$.name = $5; + $$.sorted = by_name_alignment; + $$.exclude_name_list = NULL; + } + | SORT_BY_NAME '(' SORT_BY_NAME '(' wildcard_name ')' ')' + { + $$.name = $5; + $$.sorted = by_name; + $$.exclude_name_list = NULL; + } + | SORT_BY_ALIGNMENT '(' SORT_BY_NAME '(' wildcard_name ')' ')' + { + $$.name = $5; + $$.sorted = by_alignment_name; + $$.exclude_name_list = NULL; + } + | SORT_BY_ALIGNMENT '(' SORT_BY_ALIGNMENT '(' wildcard_name ')' ')' + { + $$.name = $5; + $$.sorted = by_alignment; + $$.exclude_name_list = NULL; + } + | SORT_BY_NAME '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')' { $$.name = $7; - $$.sorted = TRUE; + $$.sorted = by_name; $$.exclude_name_list = $5; } ; @@ -481,7 +512,7 @@ input_section_spec_no_keep: struct wildcard_spec tmp; tmp.name = $1; tmp.exclude_name_list = NULL; - tmp.sorted = FALSE; + tmp.sorted = none; lang_add_wild (&tmp, NULL, ldgram_had_keep); } | '[' file_NAME_list ']' @@ -514,7 +545,7 @@ statement: lang_add_attribute(lang_constructors_statement_enum); } - | SORT '(' CONSTRUCTORS ')' + | SORT_BY_NAME '(' CONSTRUCTORS ')' { constructors_sorted = TRUE; lang_add_attribute (lang_constructors_statement_enum); |