diff options
Diffstat (limited to 'ld/testsuite')
29 files changed, 356 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index dd58a7d..7cba4a4 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,34 @@ +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 + 2004-10-01 H.J. Lu <hongjiu.lu@intel.com> * ld-powerpc/tls.s: Don't set tls type for undefined syms. diff --git a/ld/testsuite/ld-scripts/sort.exp b/ld/testsuite/ld-scripts/sort.exp new file mode 100644 index 0000000..af88223 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort.exp @@ -0,0 +1,26 @@ +# Test SORT_BY_NAME/SORT_BY_ALIGNMENT/SORT in a linker script. +# By H.J. Lu <hongjiu.lu@intel.com> +# Copyright 2004 +# Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +load_lib ld-lib.exp + +set sort_test_list [lsort [glob -nocomplain $srcdir/$subdir/sort*.d]] +for { set i 0 } { $i < [llength $sort_test_list] } { incr i } { + verbose [file rootname [lindex $sort_test_list $i]] + run_dump_test [file rootname [lindex $sort_test_list $i]] +} diff --git a/ld/testsuite/ld-scripts/sort_b_a.d b/ld/testsuite/ld-scripts/sort_b_a.d new file mode 100644 index 0000000..78fe1f1 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a.d @@ -0,0 +1,9 @@ +#source: sort_b_a.s +#ld: -T sort_b_a.t +#name: SORT_BY_ALIGNMENT +#nm: -n + +0[0-9a-f]* t text3 +0[0-9a-f]* t text1 +0[0-9a-f]* t text +0[0-9a-f]* t text2 diff --git a/ld/testsuite/ld-scripts/sort_b_a.s b/ld/testsuite/ld-scripts/sort_b_a.s new file mode 100644 index 0000000..7b3851f --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a.s @@ -0,0 +1,16 @@ + .section .text2 + .p2align 3 +text2: + .long 0 + .section .text3 + .p2align 6 +text3: + .long 0 + .section .text1 + .p2align 5 +text1: + .long 0 + .text +text: + .p2align 4 + .long 0 diff --git a/ld/testsuite/ld-scripts/sort_b_a.t b/ld/testsuite/ld-scripts/sort_b_a.t new file mode 100644 index 0000000..cbfd3c3 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a.t @@ -0,0 +1,5 @@ +SECTIONS +{ + .text : {*(SORT_BY_ALIGNMENT(.text*))} + /DISCARD/ : { *(.*) } +} diff --git a/ld/testsuite/ld-scripts/sort_b_a_a-1.d b/ld/testsuite/ld-scripts/sort_b_a_a-1.d new file mode 100644 index 0000000..4f70646 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a_a-1.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_a_a.t +#name: SORT_BY_ALIGNMENT(SORT_BY_ALIGNMENT()) +#nm: -n + +0[0-9a-f]* t text3b +0[0-9a-f]* t text3a +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b diff --git a/ld/testsuite/ld-scripts/sort_b_a_a-2.d b/ld/testsuite/ld-scripts/sort_b_a_a-2.d new file mode 100644 index 0000000..65919a4 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a_a-2.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_a_a.t --sort-section alignment +#name: SORT_BY_ALIGNMENT(SORT_BY_ALIGNMENT()) --sort-section alignment +#nm: -n + +0[0-9a-f]* t text3b +0[0-9a-f]* t text3a +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b diff --git a/ld/testsuite/ld-scripts/sort_b_a_a-3.d b/ld/testsuite/ld-scripts/sort_b_a_a-3.d new file mode 100644 index 0000000..21b7732 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a_a-3.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_a_a.t --sort-section name +#name: SORT_BY_ALIGNMENT(SORT_BY_ALIGNMENT()) --sort-section name +#nm: -n + +0[0-9a-f]* t text3b +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text3a +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b diff --git a/ld/testsuite/ld-scripts/sort_b_a_a.t b/ld/testsuite/ld-scripts/sort_b_a_a.t new file mode 100644 index 0000000..359cdff --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a_a.t @@ -0,0 +1,5 @@ +SECTIONS +{ + .text : {*(SORT_BY_ALIGNMENT(SORT_BY_ALIGNMENT(.text*)))} + /DISCARD/ : { *(.*) } +} diff --git a/ld/testsuite/ld-scripts/sort_b_a_n-1.d b/ld/testsuite/ld-scripts/sort_b_a_n-1.d new file mode 100644 index 0000000..62363bc --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a_n-1.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_a_n.t +#name: SORT_BY_ALIGNMENT(SORT_BY_NAME()) +#nm: -n + +0[0-9a-f]* t text3b +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text3a +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b diff --git a/ld/testsuite/ld-scripts/sort_b_a_n-2.d b/ld/testsuite/ld-scripts/sort_b_a_n-2.d new file mode 100644 index 0000000..7402836 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a_n-2.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_a_n.t --sort-section name +#name: SORT_BY_ALIGNMENT(SORT_BY_NAME()) --sort-section name +#nm: -n + +0[0-9a-f]* t text3b +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text3a +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b diff --git a/ld/testsuite/ld-scripts/sort_b_a_n-3.d b/ld/testsuite/ld-scripts/sort_b_a_n-3.d new file mode 100644 index 0000000..4421c77 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a_n-3.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_a_n.t --sort-section alignment +#name: SORT_BY_ALIGNMENT(SORT_BY_NAME()) --sort-section alignment +#nm: -n + +0[0-9a-f]* t text3b +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text3a +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b diff --git a/ld/testsuite/ld-scripts/sort_b_a_n.t b/ld/testsuite/ld-scripts/sort_b_a_n.t new file mode 100644 index 0000000..04c3917 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_a_n.t @@ -0,0 +1,5 @@ +SECTIONS +{ + .text : {*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.text*)))} + /DISCARD/ : { *(.*) } +} diff --git a/ld/testsuite/ld-scripts/sort_b_n.d b/ld/testsuite/ld-scripts/sort_b_n.d new file mode 100644 index 0000000..531a756 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n.d @@ -0,0 +1,9 @@ +#source: sort_b_n.s +#ld: -T sort_b_n.t +#name: SORT_BY_NAME +#nm: -n + +0[0-9a-f]* t text +0[0-9a-f]* t text1 +0[0-9a-f]* t text2 +0[0-9a-f]* t text3 diff --git a/ld/testsuite/ld-scripts/sort_b_n.s b/ld/testsuite/ld-scripts/sort_b_n.s new file mode 100644 index 0000000..c99d75c --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n.s @@ -0,0 +1,12 @@ + .section .text2 +text2: + .long 0 + .section .text3 +text3: + .long 0 + .section .text1 +text1: + .long 0 + .text +text: + .long 0 diff --git a/ld/testsuite/ld-scripts/sort_b_n.t b/ld/testsuite/ld-scripts/sort_b_n.t new file mode 100644 index 0000000..26c2b6e --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n.t @@ -0,0 +1,5 @@ +SECTIONS +{ + .text : {*(SORT_BY_NAME(.text*))} + /DISCARD/ : { *(.*) } +} diff --git a/ld/testsuite/ld-scripts/sort_b_n_a-1.d b/ld/testsuite/ld-scripts/sort_b_n_a-1.d new file mode 100644 index 0000000..ee123bf --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n_a-1.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_n_a.t +#name: SORT_BY_NAME(SORT_BY_ALIGNMENT()) +#nm: -n + +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b +0[0-9a-f]* t text3b +0[0-9a-f]* t text3a diff --git a/ld/testsuite/ld-scripts/sort_b_n_a-2.d b/ld/testsuite/ld-scripts/sort_b_n_a-2.d new file mode 100644 index 0000000..82f1805 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n_a-2.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_n_a.t --sort-section name +#name: SORT_BY_NAME(SORT_BY_ALIGNMENT()) --sort-section alignment +#nm: -n + +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b +0[0-9a-f]* t text3b +0[0-9a-f]* t text3a diff --git a/ld/testsuite/ld-scripts/sort_b_n_a-3.d b/ld/testsuite/ld-scripts/sort_b_n_a-3.d new file mode 100644 index 0000000..5f3c863 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n_a-3.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_n_a.t --sort-section alignment +#name: SORT_BY_NAME(SORT_BY_ALIGNMENT()) --sort-section alignment +#nm: -n + +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b +0[0-9a-f]* t text3b +0[0-9a-f]* t text3a diff --git a/ld/testsuite/ld-scripts/sort_b_n_a.t b/ld/testsuite/ld-scripts/sort_b_n_a.t new file mode 100644 index 0000000..49cbdd3 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n_a.t @@ -0,0 +1,5 @@ +SECTIONS +{ + .text : {*(SORT_BY_NAME(SORT_BY_ALIGNMENT(.text*)))} + /DISCARD/ : { *(.*) } +} diff --git a/ld/testsuite/ld-scripts/sort_b_n_n-1.d b/ld/testsuite/ld-scripts/sort_b_n_n-1.d new file mode 100644 index 0000000..0bc18ae --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n_n-1.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_n_n.t +#name: SORT_BY_NAME(SORT_BY_NAME()) +#nm: -n + +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b +0[0-9a-f]* t text3a +0[0-9a-f]* t text3b diff --git a/ld/testsuite/ld-scripts/sort_b_n_n-2.d b/ld/testsuite/ld-scripts/sort_b_n_n-2.d new file mode 100644 index 0000000..834bf90 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n_n-2.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_n_n.t --sort-section name +#name: SORT_BY_NAME(SORT_BY_NAME()) --sort-section name +#nm: -n + +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b +0[0-9a-f]* t text3a +0[0-9a-f]* t text3b diff --git a/ld/testsuite/ld-scripts/sort_b_n_n-3.d b/ld/testsuite/ld-scripts/sort_b_n_n-3.d new file mode 100644 index 0000000..7ba8a8b --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n_n-3.d @@ -0,0 +1,14 @@ +#source: sort_n_a-a.s +#source: sort_n_a-b.s +#ld: -T sort_b_n_n.t --sort-section alignment +#name: SORT_BY_NAME(SORT_BY_NAME()) --sort-section alignment +#nm: -n + +0[0-9a-f]* t texta +0[0-9a-f]* t textb +0[0-9a-f]* t text1a +0[0-9a-f]* t text1b +0[0-9a-f]* t text2a +0[0-9a-f]* t text2b +0[0-9a-f]* t text3b +0[0-9a-f]* t text3a diff --git a/ld/testsuite/ld-scripts/sort_b_n_n.t b/ld/testsuite/ld-scripts/sort_b_n_n.t new file mode 100644 index 0000000..b4eabfe --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_b_n_n.t @@ -0,0 +1,5 @@ +SECTIONS +{ + .text : {*(SORT_BY_NAME(SORT_BY_NAME(.text*)))} + /DISCARD/ : { *(.*) } +} diff --git a/ld/testsuite/ld-scripts/sort_n_a-a.s b/ld/testsuite/ld-scripts/sort_n_a-a.s new file mode 100644 index 0000000..77dfc35 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_n_a-a.s @@ -0,0 +1,16 @@ + .section .text2 + .p2align 3 +text2a: + .long 0 + .section .text3 + .p2align 5 +text3a: + .long 0 + .section .text1 + .p2align 5 +text1a: + .long 0 + .text +texta: + .p2align 4 + .long 0 diff --git a/ld/testsuite/ld-scripts/sort_n_a-b.s b/ld/testsuite/ld-scripts/sort_n_a-b.s new file mode 100644 index 0000000..781ba4e --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_n_a-b.s @@ -0,0 +1,16 @@ + .section .text2 + .p2align 3 +text2b: + .long 0 + .section .text3 + .p2align 6 +text3b: + .long 0 + .section .text1 + .p2align 5 +text1b: + .long 0 + .text +textb: + .p2align 4 + .long 0 diff --git a/ld/testsuite/ld-scripts/sort_no-1.d b/ld/testsuite/ld-scripts/sort_no-1.d new file mode 100644 index 0000000..aef7863 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_no-1.d @@ -0,0 +1,9 @@ +#source: sort_b_n.s +#ld: -T sort_no.t +#name: no SORT_BY_NAME/SORT_BY_ALIGNMENT/SORT +#nm: -n + +0[0-9a-f]* t text +0[0-9a-f]* t text2 +0[0-9a-f]* t text3 +0[0-9a-f]* t text1 diff --git a/ld/testsuite/ld-scripts/sort_no-2.d b/ld/testsuite/ld-scripts/sort_no-2.d new file mode 100644 index 0000000..ddcd1c1 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_no-2.d @@ -0,0 +1,9 @@ +#source: sort_b_a.s +#ld: -T sort_no.t +#name: no SORT_BY_NAME/SORT_BY_ALIGNMENT/SORT +#nm: -n + +0[0-9a-f]* t text +0[0-9a-f]* t text2 +0[0-9a-f]* t text3 +0[0-9a-f]* t text1 diff --git a/ld/testsuite/ld-scripts/sort_no.t b/ld/testsuite/ld-scripts/sort_no.t new file mode 100644 index 0000000..d797c79 --- /dev/null +++ b/ld/testsuite/ld-scripts/sort_no.t @@ -0,0 +1,5 @@ +SECTIONS +{ + .text : {*(.text*)} + /DISCARD/ : { *(.*) } +} |