Commit | Line | Data |
---|---|---|
1b19eb81 AO |
1 | # Expect script for ld-sh tests |
2 | # Copyright (C) 2000, 2001, 2002 Free Software Foundation | |
3 | # | |
4 | # This file is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
3e8cba19 | 8 | # |
1b19eb81 AO |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
3e8cba19 | 13 | # |
1b19eb81 AO |
14 | # You should have received a copy of the GNU General Public License |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | # | |
18 | ||
19 | # Test SH linking; all types of relocs. This tests the assembler and | |
20 | # tools like objdump as well as the linker. | |
21 | ||
22 | if ![istarget sh64-*-*] { | |
23 | return | |
24 | } | |
25 | ||
1b19eb81 AO |
26 | # List contains test-items with 3 items followed by 2 lists: |
27 | # 0:name 1:ld options 2:assembler options | |
bffbf940 | 28 | # 3:filenames of assembler files 4: action and options. 5: name of output file |
1b19eb81 AO |
29 | |
30 | # Actions: | |
31 | # objdump: Apply objdump options on result. Compare with regex (last arg). | |
32 | # nm: Apply nm options on result. Compare with regex (last arg). | |
bffbf940 | 33 | # readelf: Apply readelf options on result. Compare with regex (last arg). |
1b19eb81 AO |
34 | |
35 | # Note that the contents dump is the same for "inter-file datalabel | |
36 | # references, 64-bit ABI" as for 32-bit ABI and ELF so we re-use it. | |
37 | ||
38 | set sh64tests { | |
39 | {"SH64 linking, 64-bit ABI" "-mshelf64" | |
40 | "--abi=64" {sh64-1.s sh64-2.s} | |
bffbf940 | 41 | {{objdump -sr abi64.sd} {objdump -x abi64.xd}} "abi64.bin" } |
1b19eb81 AO |
42 | {"SH64 linking, 64-bit ABI, -no-expand" "-mshelf64" |
43 | "--abi=64 -no-expand" {sh64-1.s sh64-2.s} | |
bffbf940 | 44 | {{objdump -sr abixx-noexp.sd}} "abi64-noexp.bin" } |
1b19eb81 AO |
45 | {"SH64 linking, 32-bit ABI" "-mshelf32" |
46 | "--abi=32" {sh64-1.s sh64-2.s} | |
bffbf940 | 47 | {{objdump -sr abi32.sd} {objdump -x abi32.xd}} "abi32.bin" } |
1b19eb81 AO |
48 | {"SH64 linking, 32-bit ABI, -no-expand" "-mshelf32" |
49 | "--abi=32 -no-expand" {sh64-1.s sh64-2.s} | |
bffbf940 | 50 | {{objdump -sr abixx-noexp.sd}} "abi32-noexp.bin" } |
1b19eb81 AO |
51 | {"SH64 linking, single multi-ISA object" "-mshelf32" |
52 | "--abi=32" {shmix-1.s} | |
bffbf940 | 53 | {{objdump -sr mix1.sd} {objdump -x mix1.xd}} "mix1.bin" } |
1b19eb81 AO |
54 | {"SH64 linking, single multi-ISA object, -no-expand" "-mshelf32" |
55 | "--abi=32 -no-expand" {shmix-1.s} | |
bffbf940 | 56 | {{objdump -sr mix1-noexp.sd}} "mix1-noexp.bin" } |
1b19eb81 AO |
57 | {"SH64 linking, two different-ISA objects" "-mshelf32" |
58 | "--abi=32" {shmix-2.s shmix-3.s} | |
bffbf940 | 59 | {{objdump -sr mix2.sd} {objdump -x mix2.xd}} "mix2.bin" } |
1b19eb81 AO |
60 | {"SH64 linking, two different-ISA objects, -no-expand" "-mshelf32" |
61 | "--abi=32 -no-expand" {shmix-2.s shmix-3.s} | |
bffbf940 | 62 | {{objdump -sr mix2-noexp.sd}} "mix2-noexp.bin" } |
1b19eb81 AO |
63 | {"SH64 linking, single SHcompact" "-mshelf32" |
64 | "--isa=SHcompact" {shcmp-1.s} | |
bffbf940 | 65 | {{objdump -sr cmpct1.sd} {objdump -x cmpct1.xd}} "cmpct1.bin" } |
1b19eb81 AO |
66 | {"SH64 inter-file datalabel references, 64-bit ABI" "-mshelf64" |
67 | "--abi=64" {shdl-1.s shdl-2.s} | |
bffbf940 | 68 | {{objdump -sr shdl64.sd} {objdump -x shdl64.xd}} "shdl64.bin" } |
1b19eb81 AO |
69 | {"SH64 inter-file datalabel references, 32-bit ABI" "-mshelf32" |
70 | "--abi=32" {shdl-1.s shdl-2.s} | |
bffbf940 | 71 | {{objdump -sr shdl64.sd} {objdump -x shdl32.xd}} "shdl32.bin" } |
0b65791f SC |
72 | {"SH64 inter-file datalabel references and gc-sections, 32-bit ABI" "-mshelf32 --gc-sections" |
73 | "--abi=32" {dlsection-1.s } | |
bffbf940 | 74 | {{objdump -sr dlsection.sd}} "dlsection32.bin" } |
0b65791f SC |
75 | {"SH64 inter-file datalabel references and gc-sections, 64-bit ABI" "-mshelf64 --gc-sections" |
76 | "--abi=64" {dlsection-1.s } | |
bffbf940 | 77 | {{objdump -sr dlsection.sd}} "dlsection64.bin" } |
1b19eb81 AO |
78 | {"SH64 simple partial linking, 32-bit ABI" "-mshelf32 -r" |
79 | "--abi=32" {rel-1.s rel-2.s} | |
bffbf940 | 80 | {{objdump -sx rel32.xd}} "rel32.bin" } |
1b19eb81 AO |
81 | {"SH64 simple partial linking, 64-bit ABI" "-mshelf64 -r" |
82 | "--abi=64" {rel-1.s rel-2.s} | |
bffbf940 | 83 | {{objdump -sx rel64.xd}} "rel64.bin" } |
1b19eb81 AO |
84 | {"SH64 partial linking with datalabel references, 32-bit ABI" "-mshelf32 -r" |
85 | "--abi=32" {reldl-1.s reldl-2.s} | |
bffbf940 | 86 | {{readelf {-s -r -x 1 -x 3} reldl32.rd}} "reldl32.bin" } |
1b19eb81 AO |
87 | {"SH64 partial linking with datalabel references, 64-bit ABI" "-mshelf64 -r" |
88 | "--abi=64" {reldl-1.s reldl-2.s} | |
bffbf940 | 89 | {{readelf {-s -r -x 1 -x 3} reldl64.rd}} "reldl64.bin" } |
1b19eb81 AO |
90 | {"Handling SH64 assembler-generated .cranges" "-mshelf32" |
91 | "--abi=32" {crange-2a.s crange-1.s} | |
bffbf940 | 92 | {{readelf {-S -s -r -x 1 -x 2 -x 9} crange1.rd}} "crange1.bin" } |
1b19eb81 AO |
93 | {"Handling SH64 assembler-generated .cranges, partial linking" "-mshelf32 -r" |
94 | "--abi=32" {crange-2a.s} | |
bffbf940 | 95 | {{readelf {-S -s -r -x 2 -x 5} crangerel1.rd}} "crangerel1.bin" } |
1b19eb81 AO |
96 | {"Mixing SH64 assembler-generated with linker-generated .cranges" "-mshelf32" |
97 | "--abi=32" {crange-2a.s crange-2b.s crange-1.s} | |
bffbf940 | 98 | {{readelf {-S -s -r -x 2 -x 9} crange2.rd}} "crange2.bin" } |
1b19eb81 AO |
99 | {"Mixing SH64 assembler-generated with linker-generated .cranges, partial linking" |
100 | "-mshelf32 -r" | |
101 | "--abi=32" {crange-2a.s crange-2c.s crange-2d.s crange-2e.s} | |
bffbf940 | 102 | {{readelf {-S -s -r -x 2 -x 5} crangerel2.rd}} "crangerel2.bin" } |
1b19eb81 AO |
103 | {"Merge and use of SH64 .cranges, some not originally in order" "-mshelf32" |
104 | "--abi=32" | |
105 | {crange-2e.s crange-2f.s crange-2g.s crange-2a.s crange-2d.s crange-2i.s | |
106 | crange-2h.s crange-1.s} | |
bffbf940 | 107 | {{readelf {-S -s -x 2 -x 9} crange3.rd} {objdump -d crange3.dd}} "crange3.bin" } |
1b19eb81 AO |
108 | {"Sorted SH64 .cranges, entry at SHcompact code" "-mshelf32 --entry diversion" |
109 | "--abi=32" | |
110 | {crange-2e.s crange-2f.s crange-2g.s crange-2a.s crange-2d.s crange-2i.s | |
111 | crange-2h.s crange-1.s} | |
bffbf940 | 112 | {{readelf {-h -S -s -x 2 -x 9} crange3-cmpct.rd}} "crange3-cmpct.bin" } |
1b19eb81 AO |
113 | {"Sorted SH64 .cranges, entry at SHmedia code" "-mshelf32 --entry diversion2" |
114 | "--abi=32" | |
115 | {crange-2e.s crange-2f.s crange-2g.s crange-2a.s crange-2d.s crange-2i.s | |
116 | crange-2h.s crange-1.s} | |
bffbf940 | 117 | {{readelf {-h -S -s -x 2 -x 9} crange3-media.rd}} "crange3-media.bin" } |
1b19eb81 AO |
118 | {"SH64 Big Endianness" "-mshelf64 -Tendian.ld" |
119 | "--abi=64" {endian.s} | |
bffbf940 | 120 | {{objdump -s endian.sbd} {objdump -d endian.dbd}} "endianb.bin" } |
1b19eb81 AO |
121 | {"SH64 Little Endianness" "-mshlelf64 -Tendian.ld" |
122 | "--abi=64 --little" {endian.s} | |
bffbf940 | 123 | {{objdump -s endian.sld} {objdump -d endian.dld}} "endinanl.bin" } |
1b19eb81 AO |
124 | } |
125 | ||
126 | run_ld_link_tests $sh64tests |