diff options
author | Michael Matz <matz@suse.de> | 2022-11-10 16:06:20 +0100 |
---|---|---|
committer | Michael Matz <matz@suse.de> | 2022-11-28 16:30:18 +0100 |
commit | af31506c31a59a6edbb13498d6075fa704b801cd (patch) | |
tree | ef51c9ca7ae6683c3a2fc134e3b4074245df4dc0 /ld/testsuite | |
parent | Special case more simple patterns (diff) | |
download | binutils-gdb-af31506c31a59a6edbb13498d6075fa704b801cd.tar.gz binutils-gdb-af31506c31a59a6edbb13498d6075fa704b801cd.tar.bz2 binutils-gdb-af31506c31a59a6edbb13498d6075fa704b801cd.zip |
Only use wild_sort_fast
there's no reason why the tree-based variant can't always be used
when sorting is required, it merely needs to also support filename
sorting and have a fast path for insertion at end (aka rightmost tree
leaf).
The filename sorting isn't tested anywhere and the only scripttempl
that uses it is avr (for 'SORT(*)(.ctors)'), and I believe even there it
was a mistake. Either way, this adds a testcase for filename sorting as
well.
Then the non-BST based sorting can be simplified to only support
the fast case of no sorting required at all (at the same time renaming
the two variants to _sort and _nosort).
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ld-scripts/sort-file.d | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/sort-file.t | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/sort-file1.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/sort-file2.s | 6 |
4 files changed, 36 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/sort-file.d b/ld/testsuite/ld-scripts/sort-file.d new file mode 100644 index 00000000000..01eb694c63f --- /dev/null +++ b/ld/testsuite/ld-scripts/sort-file.d @@ -0,0 +1,18 @@ +#source: sort-file2.s +#source: sort-file1.s +#ld: -T sort-file.t +#nm: -n + +# Check that SORT_BY_NAME on filenames works +# the text sections should come in sorted order, the data +# sections in input order. Note how we specifically pass +# the object filenames in non-alphabetical order +#... +0[0-9a-f]* t infile1 +#... +0[0-9a-f]* t infile2 +#... +0[0-9a-f]* d data2 +#... +0[0-9a-f]* d data1 +#pass diff --git a/ld/testsuite/ld-scripts/sort-file.t b/ld/testsuite/ld-scripts/sort-file.t new file mode 100644 index 00000000000..559a0009256 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort-file.t @@ -0,0 +1,6 @@ +SECTIONS +{ + .text : { SORT_BY_NAME(*)(.text*) } + .data : { *(.data*) } + /DISCARD/ : { *(.*) } +} diff --git a/ld/testsuite/ld-scripts/sort-file1.s b/ld/testsuite/ld-scripts/sort-file1.s new file mode 100644 index 00000000000..23777a8591c --- /dev/null +++ b/ld/testsuite/ld-scripts/sort-file1.s @@ -0,0 +1,6 @@ + .text +infile1: + .long 0 + .data +data1: + .long 0 diff --git a/ld/testsuite/ld-scripts/sort-file2.s b/ld/testsuite/ld-scripts/sort-file2.s new file mode 100644 index 00000000000..cf4bb1f9f1a --- /dev/null +++ b/ld/testsuite/ld-scripts/sort-file2.s @@ -0,0 +1,6 @@ + .text +infile2: + .long 0 + .data +data2: + .long 0 |