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/testsuite/ld-scripts | |
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/testsuite/ld-scripts')
-rw-r--r-- | ld/testsuite/ld-scripts/align.exp | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/align3.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/align3.t | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/align4.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/align4.t | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/align5.d | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/align5.t | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-5.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-5.map | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-5.t | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-6.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-6.map | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-6.t | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-7.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-7.map | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/exclude-file-7.t | 11 |
16 files changed, 120 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/align.exp b/ld/testsuite/ld-scripts/align.exp index a41db72..ba229af 100644 --- a/ld/testsuite/ld-scripts/align.exp +++ b/ld/testsuite/ld-scripts/align.exp @@ -47,6 +47,9 @@ if ![ld_link $ld tmpdir/align "$LDFLAGS -T $srcdir/$subdir/align.t tmpdir/align. if ![is_aout_format] { run_dump_test align2a run_dump_test align2b + run_dump_test align3 + run_dump_test align4 + run_dump_test align5 } run_dump_test align2c set LDFLAGS "$saved_LDFLAGS" diff --git a/ld/testsuite/ld-scripts/align3.d b/ld/testsuite/ld-scripts/align3.d new file mode 100644 index 0000000..384d91a --- /dev/null +++ b/ld/testsuite/ld-scripts/align3.d @@ -0,0 +1,3 @@ +# source: align2a.s +# ld: -T align3.t +# error: .*:4: syntax error diff --git a/ld/testsuite/ld-scripts/align3.t b/ld/testsuite/ld-scripts/align3.t new file mode 100644 index 0000000..5c9e5bf --- /dev/null +++ b/ld/testsuite/ld-scripts/align3.t @@ -0,0 +1,10 @@ +SECTIONS +{ + .text : { + SORT_BY_ALIGNMENT (*) (.text .text.*) + } + + .data : { + SORT_BY_ALIGNMENT (*) (.data .data.*) + } +}
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/align4.d b/ld/testsuite/ld-scripts/align4.d new file mode 100644 index 0000000..661738a --- /dev/null +++ b/ld/testsuite/ld-scripts/align4.d @@ -0,0 +1,3 @@ +# source: align2a.s +# ld: -T align4.t +# error: .*:4: syntax error diff --git a/ld/testsuite/ld-scripts/align4.t b/ld/testsuite/ld-scripts/align4.t new file mode 100644 index 0000000..fc80905 --- /dev/null +++ b/ld/testsuite/ld-scripts/align4.t @@ -0,0 +1,10 @@ +SECTIONS +{ + .text : { + SORT_BY_INIT_PRIORITY (*) (.text .text.*) + } + + .data : { + SORT_BY_INIT_PRIORITY (*) (.data .data.*) + } +}
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/align5.d b/ld/testsuite/ld-scripts/align5.d new file mode 100644 index 0000000..880b6fb --- /dev/null +++ b/ld/testsuite/ld-scripts/align5.d @@ -0,0 +1,7 @@ +# source: align2a.s +# ld: -T align5.t +# nm: -n + +#... +.*foo +#...
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/align5.t b/ld/testsuite/ld-scripts/align5.t new file mode 100644 index 0000000..a0b33e5 --- /dev/null +++ b/ld/testsuite/ld-scripts/align5.t @@ -0,0 +1,12 @@ +SECTIONS +{ + .text : { + SORT_NONE (*) (.text .text.*) + } + + .data : { + SORT_NONE (*) (.data .data.*) + foo = .; + } + /DISCARD/ : {*(*)} +} diff --git a/ld/testsuite/ld-scripts/exclude-file-5.d b/ld/testsuite/ld-scripts/exclude-file-5.d new file mode 100644 index 0000000..dc7040b --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-5.d @@ -0,0 +1,5 @@ +#source: exclude-file-a.s +#source: exclude-file-b.s +#ld: -T exclude-file-5.t +#map: exclude-file-5.map + diff --git a/ld/testsuite/ld-scripts/exclude-file-5.map b/ld/testsuite/ld-scripts/exclude-file-5.map new file mode 100644 index 0000000..9148fd6 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-5.map @@ -0,0 +1,8 @@ +#... +\.data +0x[0-9a-f]+ +0x[0-9a-f]+ + \*\(SORT_BY_NAME\(EXCLUDE_FILE\(\*-b\.o\) \.data\)\) + \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o + \*\(SORT_BY_NAME\(EXCLUDE_FILE\(\*-a\.o\) \.data\.\*\)\) + \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-b\.o + +#...
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/exclude-file-5.t b/ld/testsuite/ld-scripts/exclude-file-5.t new file mode 100644 index 0000000..e20f5ae --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-5.t @@ -0,0 +1,11 @@ +SECTIONS +{ + .data : { + * (SORT_BY_NAME (EXCLUDE_FILE (*-b.o) .data)) + * (SORT_BY_NAME (SORT_BY_NAME (EXCLUDE_FILE (*-a.o) .data.*))) + } + + /DISCARD/ : { + * (*) + } +} diff --git a/ld/testsuite/ld-scripts/exclude-file-6.d b/ld/testsuite/ld-scripts/exclude-file-6.d new file mode 100644 index 0000000..7bc9d65 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-6.d @@ -0,0 +1,5 @@ +#source: exclude-file-a.s +#source: exclude-file-b.s +#ld: -T exclude-file-6.t +#map: exclude-file-6.map + diff --git a/ld/testsuite/ld-scripts/exclude-file-6.map b/ld/testsuite/ld-scripts/exclude-file-6.map new file mode 100644 index 0000000..42e1b38 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-6.map @@ -0,0 +1,8 @@ +#... +\.data +0x[0-9a-f]+ +0x[0-9a-f]+ + \*\(SORT_BY_ALIGNMENT\(SORT_BY_NAME\(EXCLUDE_FILE\(\*-b\.o\) \.data\)\)\) + \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o + \*\(SORT_BY_NAME\(SORT_BY_ALIGNMENT\(EXCLUDE_FILE\(\*-a\.o\) \.data\.\*\)\)\) + \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-b\.o + +#...
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/exclude-file-6.t b/ld/testsuite/ld-scripts/exclude-file-6.t new file mode 100644 index 0000000..437e240 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-6.t @@ -0,0 +1,11 @@ +SECTIONS +{ + .data : { + * (SORT_BY_ALIGNMENT (SORT_BY_NAME (EXCLUDE_FILE (*-b.o) .data))) + * (SORT_BY_NAME (SORT_BY_ALIGNMENT (EXCLUDE_FILE (*-a.o) .data.*))) + } + + /DISCARD/ : { + * (*) + } +} diff --git a/ld/testsuite/ld-scripts/exclude-file-7.d b/ld/testsuite/ld-scripts/exclude-file-7.d new file mode 100644 index 0000000..8970415 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-7.d @@ -0,0 +1,5 @@ +#source: exclude-file-a.s +#source: exclude-file-b.s +#ld: -T exclude-file-7.t +#map: exclude-file-7.map + diff --git a/ld/testsuite/ld-scripts/exclude-file-7.map b/ld/testsuite/ld-scripts/exclude-file-7.map new file mode 100644 index 0000000..eb1d0a8 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-7.map @@ -0,0 +1,8 @@ +#... +\.data +0x[0-9a-f]+ +0x[0-9a-f]+ + \*\(SORT_BY_INIT_PRIORITY\(EXCLUDE_FILE\(\*-b\.o\) \.data\)\) + \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o + \*\(SORT_BY_ALIGNMENT\(EXCLUDE_FILE\(\*-a\.o\) \.data\.\*\)\) + \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-b\.o + +#...
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/exclude-file-7.t b/ld/testsuite/ld-scripts/exclude-file-7.t new file mode 100644 index 0000000..200096e --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-7.t @@ -0,0 +1,11 @@ +SECTIONS +{ + .data : { + * (SORT_BY_INIT_PRIORITY (EXCLUDE_FILE (*-b.o) .data)) + * (SORT_BY_ALIGNMENT (SORT_BY_ALIGNMENT (EXCLUDE_FILE (*-a.o) .data.*))) + } + + /DISCARD/ : { + * (*) + } +} |