Commit | Line | Data |
---|---|---|
a657e7c1 | 1 | # Expect script for MIPS ELF linker tests |
aa820537 AM |
2 | # Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
3 | # Free Software Foundation, Inc. | |
a657e7c1 | 4 | # |
f96b4a7b NC |
5 | # This file is part of the GNU Binutils. |
6 | # | |
7 | # This program is free software; you can redistribute it and/or modify | |
a657e7c1 | 8 | # it under the terms of the GNU General Public License as published by |
f96b4a7b | 9 | # the Free Software Foundation; either version 3 of the License, or |
a657e7c1 CD |
10 | # (at your option) any later version. |
11 | # | |
12 | # This program is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
17 | # You should have received a copy of the GNU General Public License | |
18 | # along with this program; if not, write to the Free Software | |
f96b4a7b NC |
19 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
20 | # MA 02110-1301, USA. | |
a657e7c1 CD |
21 | # |
22 | ||
0a44bf69 RS |
23 | if {[istarget "mips*-*-vxworks"]} { |
24 | set mipsvxtests { | |
25 | {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" | |
26 | "-mips2" {vxworks1-lib.s} | |
27 | {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} | |
9e3313ae | 28 | {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} |
0a44bf69 RS |
29 | "libvxworks1.so"} |
30 | {"VxWorks executable test 1 (dynamic)" \ | |
31 | "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" | |
32 | "-mips2" {vxworks1.s} | |
33 | {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} | |
34 | "vxworks1"} | |
35 | {"VxWorks executable test 2 (dynamic)" \ | |
36 | "-Tvxworks1.ld -q --force-dynamic" | |
37 | "-mips2" {vxworks2.s} | |
38 | {{readelf --segments vxworks2.sd}} | |
39 | "vxworks2"} | |
40 | {"VxWorks executable test 2 (static)" | |
41 | "-Tvxworks1.ld" | |
42 | "-mips2" {vxworks2.s} | |
43 | {{readelf --segments vxworks2-static.sd}} | |
44 | "vxworks2"} | |
45 | } | |
46 | run_ld_link_tests $mipsvxtests | |
47 | run_dump_test "vxworks1-static" | |
8275b357 | 48 | run_dump_test "vxworks-forced-local-1" |
0a44bf69 RS |
49 | return |
50 | } | |
51 | ||
fbf18a5c TS |
52 | if {![istarget mips*-*-*] || ![is_elf_format]} { |
53 | return | |
54 | } | |
30a2f863 | 55 | |
fbf18a5c TS |
56 | set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]] |
57 | set linux_gnu [expr [istarget mips*-*-linux*]] | |
58 | set embedded_elf [expr [istarget mips*-*-elf]] | |
30a2f863 | 59 | |
738e5348 RS |
60 | if { $linux_gnu } { |
61 | run_ld_link_tests [list \ | |
62 | [list "Dummy shared library for MIPS16 PIC test 1" \ | |
63 | "-shared -melf32btsmip" \ | |
3c0bfb2a RS |
64 | "-EB -32 -mips1" \ |
65 | { mips16-pic-1-dummy.s } \ | |
738e5348 RS |
66 | {} \ |
67 | "mips16-pic-1-dummy.so"] \ | |
68 | [list "MIPS16 PIC test 1" \ | |
69 | "-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-1-dummy.so" \ | |
3c0bfb2a RS |
70 | "-EB -32 -mips1 -I $srcdir/$subdir" \ |
71 | { mips16-pic-1a.s mips16-pic-1b.s } \ | |
738e5348 RS |
72 | { { objdump { -dr -j.text } mips16-pic-1.dd } |
73 | { readelf -A mips16-pic-1.gd } } \ | |
74 | "mips16-pic-1"] \ | |
75 | [list "MIPS16 PIC test 2" \ | |
76 | "-melf32btsmip -T mips16-pic-1.ld -shared" \ | |
3c0bfb2a RS |
77 | "-EB -32 -mips1 -I $srcdir/$subdir" \ |
78 | { mips16-pic-2a.s mips16-pic-2b.s } \ | |
738e5348 RS |
79 | { { objdump { -dr -j.text } mips16-pic-2.dd } \ |
80 | { readelf -A mips16-pic-2.gd } \ | |
81 | { readelf --symbols mips16-pic-2.nd } \ | |
82 | { readelf --relocs mips16-pic-2.rd } \ | |
83 | { readelf -d mips16-pic-2.ad } } \ | |
861fb55a DJ |
84 | "mips16-pic-2"] \ |
85 | [list "MIPS16 PIC test 3" \ | |
86 | "-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-1-dummy.so" \ | |
3c0bfb2a RS |
87 | "-EB -32 -mips1 -I $srcdir/$subdir" \ |
88 | { mips16-pic-3a.s mips16-pic-3b.s } \ | |
861fb55a DJ |
89 | { { objdump -dr mips16-pic-3.dd } \ |
90 | { readelf --relocs mips16-pic-3.rd } \ | |
91 | { readelf -A mips16-pic-3.gd } } \ | |
61b0a4af RS |
92 | "mips16-pic-3"] \ |
93 | [list "MIPS16 PIC test 4 (shared library)" \ | |
94 | "-shared -melf32btsmip -T mips16-pic-1.ld --version-script mips16-pic-4.ver" \ | |
3c0bfb2a RS |
95 | "-EB -32 -mips1" \ |
96 | { mips16-pic-4a.s mips16-pic-4b.s } \ | |
61b0a4af RS |
97 | { { objdump -dr mips16-pic-4a.dd } \ |
98 | { readelf --symbols mips16-pic-4a.nd } \ | |
99 | { readelf -A mips16-pic-4a.gd } } \ | |
100 | "mips16-pic-4.so"] \ | |
101 | [list "MIPS16 PIC test 4 (executable)" \ | |
102 | "-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-4.so" \ | |
3c0bfb2a RS |
103 | "-EB -32 -mips1" \ |
104 | { mips16-pic-4c.s } \ | |
61b0a4af RS |
105 | { { objdump -dr mips16-pic-4b.dd } } \ |
106 | "mips16-pic-4"]] | |
738e5348 RS |
107 | } |
108 | ||
08e8dfaf RS |
109 | if { [istarget mips64*-linux-gnu] } { |
110 | set o32_as_flags "-32 -EB" | |
111 | set o32_ld_flags "-melf32btsmip" | |
aeffff67 RS |
112 | } elseif { [istarget mips64*-*freebsd*] } { |
113 | set o32_as_flags "-32 -EB" | |
114 | set o32_ld_flags "-melf32btsmip_fbsd" | |
08e8dfaf RS |
115 | } else { |
116 | set o32_as_flags "" | |
117 | set o32_ld_flags "" | |
118 | } | |
30a2f863 | 119 | |
fbf18a5c TS |
120 | # Check MIPS16 markings being passed through link. |
121 | run_dump_test "mips16-1" | |
8914585c | 122 | |
fbf18a5c TS |
123 | # MIPS branch offset final link checking. |
124 | run_dump_test "branch-misc-1" | |
7d6c7577 | 125 | |
df58fc94 RS |
126 | # Jalx test |
127 | run_dump_test "jalx-1" | |
128 | ||
129 | if { $linux_gnu } { | |
130 | run_ld_link_tests [list \ | |
131 | [list "Dummy shared library for JALX test 2" \ | |
132 | "-shared -nostdlib -melf32btsmip" \ | |
133 | "-G0 -EB -mmicromips -no-mdebug -mabi=32 -march=mips32r2 -KPIC" \ | |
134 | { jalx-2-printf.s } \ | |
135 | {} \ | |
136 | "libjalx-2.so"] \ | |
137 | [list "Dummy external function for JALX test 2" \ | |
138 | "-r -melf32btsmip" \ | |
139 | "-G0 -EB -no-mdebug -mabi=32 -march=mips32r2 -mno-shared -call_nonpic" \ | |
140 | { jalx-2-ex.s } \ | |
141 | {} \ | |
142 | "jalx-2-ex.o.r"] \ | |
143 | [list "MIPS JALX test 2" \ | |
144 | "-nostdlib -T jalx-2.ld tmpdir/libjalx-2.so tmpdir/jalx-2-ex.o.r -melf32btsmip" \ | |
145 | "-G0 -EB -mmicromips -no-mdebug -mabi=32 -march=mips32r2 -mno-shared -call_nonpic" \ | |
146 | { jalx-2-main.s } \ | |
147 | { { objdump -d jalx-2.dd } } \ | |
148 | "jalx-2"]] | |
149 | } | |
150 | ||
732be173 DJ |
151 | # Test multi-got link. We only do this on GNU/Linux because it requires |
152 | # the "traditional" emulations. | |
153 | if { $linux_gnu } { | |
154 | run_dump_test "multi-got-1" | |
bbe506e8 | 155 | run_dump_test "multi-got-no-shared" |
2152e047 DJ |
156 | run_dump_test "multi-got-hidden-1" |
157 | run_dump_test "multi-got-hidden-2" | |
732be173 | 158 | } |
30a2f863 | 159 | |
0a61c8c2 RS |
160 | # Test __gnu_local_gp accesses |
161 | if { $linux_gnu } { | |
162 | run_dump_test "no-shared-1-o32" | |
163 | if { $has_newabi } { | |
164 | run_dump_test "no-shared-1-n32" | |
165 | run_dump_test "no-shared-1-n64" | |
166 | } | |
167 | } | |
168 | ||
fbf18a5c TS |
169 | if $has_newabi { |
170 | run_dump_test "elf-rel-got-n32" | |
171 | run_dump_test "elf-rel-xgot-n32" | |
48fe7bda | 172 | if { $linux_gnu } { |
fbf18a5c TS |
173 | run_dump_test "elf-rel-got-n64-linux" |
174 | run_dump_test "elf-rel-xgot-n64-linux" | |
175 | } else { | |
176 | run_dump_test "elf-rel-got-n64" | |
177 | run_dump_test "elf-rel-xgot-n64" | |
48fe7bda AO |
178 | } |
179 | ||
fbf18a5c TS |
180 | run_dump_test "relax-jalr-n32" |
181 | run_dump_test "relax-jalr-n32-shared" | |
182 | run_dump_test "relax-jalr-n64" | |
183 | run_dump_test "relax-jalr-n64-shared" | |
184 | } | |
48fe7bda | 185 | |
fbf18a5c TS |
186 | if { $linux_gnu } { |
187 | run_dump_test "rel32-o32" | |
250826bd RS |
188 | if { $has_newabi } { |
189 | run_dump_test "rel32-n32" | |
190 | run_dump_test "rel64" | |
191 | } | |
861fb55a DJ |
192 | # The first test checks that a mixed PIC/non-PIC relocatable link |
193 | # will not introduce any stubs itself, but will flag PIC functions | |
194 | # for the final link. | |
195 | # | |
196 | # The second test checks that we insert stubs for calls from | |
197 | # non-PIC functions to PIC functions when linking the original | |
198 | # two objects together. | |
199 | # | |
200 | # The third test checks that we do the same when linking the | |
201 | # result of the first link (with no other source files). | |
202 | run_ld_link_tests { | |
203 | {"PIC and non-PIC test 1 (relocatable)" "-r -melf32btsmip" | |
204 | "-32 -EB -mips2" {pic-and-nonpic-1a.s pic-and-nonpic-1b.s} | |
205 | {{objdump -dr pic-and-nonpic-1-rel.dd} | |
206 | {readelf --symbols pic-and-nonpic-1-rel.nd}} | |
207 | "pic-and-nonpic-1-rel.o"} | |
208 | {"PIC and non-PIC test 1 (static 1)" | |
209 | "-melf32btsmip -Tpic-and-nonpic-1.ld" | |
210 | "-32 -EB -mips2" {pic-and-nonpic-1a.s pic-and-nonpic-1b.s} | |
211 | {{objdump -dr pic-and-nonpic-1.dd} | |
212 | {readelf --symbols pic-and-nonpic-1.nd}} | |
213 | "pic-and-nonpic-1-static1.o"} | |
214 | {"PIC and non-PIC test 1 (static 2)" | |
215 | "-melf32btsmip -Tpic-and-nonpic-1.ld tmpdir/pic-and-nonpic-1-rel.o" | |
216 | "" {} | |
217 | {{objdump -dr pic-and-nonpic-1.dd} | |
218 | {readelf --symbols pic-and-nonpic-1.nd}} | |
219 | "pic-and-nonpic-1-static2.o"} | |
220 | } | |
221 | run_dump_test "pic-and-nonpic-2" | |
222 | run_ld_link_tests { | |
223 | {"PIC and non-PIC test 3 (shared library)" | |
224 | "-melf32btsmip -shared -Tpic-and-nonpic-3a.ld" | |
225 | "-32 -EB -mips2" {pic-and-nonpic-3a.s} | |
226 | {{readelf --segments pic-and-nonpic-3a.sd} | |
227 | {readelf -A pic-and-nonpic-3a.gd} | |
228 | {objdump -dr pic-and-nonpic-3a.dd}} | |
229 | "pic-and-nonpic-3a.so"} | |
230 | {"PIC and non-PIC test 3 (executable)" | |
231 | "-melf32btsmip -Tpic-and-nonpic-3b.ld tmpdir/pic-and-nonpic-3a.so" | |
232 | "-32 -EB -mips2" {pic-and-nonpic-3b.s} | |
233 | {{readelf --segments pic-and-nonpic-3b.sd} | |
234 | {objdump -dr pic-and-nonpic-3b.dd} | |
235 | {objdump {-s -j.got.plt} pic-and-nonpic-3b.pd} | |
236 | {readelf -A pic-and-nonpic-3b.gd} | |
237 | {readelf --relocs pic-and-nonpic-3b.rd} | |
238 | {readelf --symbols pic-and-nonpic-3b.nd} | |
239 | {readelf -d pic-and-nonpic-3b.ad}} | |
240 | "pic-and-nonpic-3b"} | |
241 | } | |
242 | run_dump_test "pic-and-nonpic-3-error" | |
243 | run_ld_link_tests { | |
244 | {"PIC and non-PIC test 4 (shared library)" | |
245 | "-melf32btsmip -shared -Tpic-and-nonpic-3a.ld" | |
246 | "-32 -EB -mips2" {pic-and-nonpic-4a.s} | |
247 | {} | |
248 | "pic-and-nonpic-4a.so"} | |
249 | {"PIC and non-PIC test 4 (executable)" | |
250 | "-melf32btsmip -Tpic-and-nonpic-4b.ld tmpdir/pic-and-nonpic-4a.so" | |
251 | "-32 -EB -mips2" {pic-and-nonpic-4b.s} | |
252 | {{readelf --segments pic-and-nonpic-4b.sd} | |
253 | {objdump -dr pic-and-nonpic-4b.dd} | |
254 | {objdump {-s -j.got -j.data} pic-and-nonpic-4b.gd} | |
255 | {readelf --relocs pic-and-nonpic-4b.rd} | |
256 | {readelf --symbols pic-and-nonpic-4b.nd} | |
257 | {readelf -d pic-and-nonpic-4b.ad}} | |
258 | "pic-and-nonpic-4b"} | |
259 | } | |
260 | run_dump_test "pic-and-nonpic-4-error" | |
261 | run_ld_link_tests { | |
262 | {"PIC and non-PIC test 5 (executable)" | |
263 | "-melf32btsmip -Tpic-and-nonpic-5b.ld tmpdir/pic-and-nonpic-3a.so tmpdir/pic-and-nonpic-4a.so" | |
264 | "-32 -EB -mips2" {pic-and-nonpic-5a.s pic-and-nonpic-5b.s} | |
265 | {{readelf --segments pic-and-nonpic-5b.sd} | |
266 | {objdump -dr pic-and-nonpic-5b.dd} | |
267 | {objdump {-s -j.got.plt -j.data} pic-and-nonpic-5b.pd} | |
268 | {readelf -A pic-and-nonpic-5b.gd} | |
269 | {readelf --relocs pic-and-nonpic-5b.rd} | |
270 | {readelf --symbols pic-and-nonpic-5b.nd} | |
271 | {readelf -d pic-and-nonpic-5b.ad}} | |
272 | "pic-and-nonpic-5b"} | |
273 | } | |
274 | set abis { o32 -32 elf32btsmip } | |
275 | if $has_newabi { | |
276 | lappend abis n32 -n32 elf32btsmipn32 | |
277 | lappend abis n64 -64 elf64btsmip | |
278 | } | |
279 | foreach { abi flag emul } $abis { | |
280 | run_ld_link_tests [list \ | |
281 | [list "PIC and non-PIC test 6 ($abi shared library)" \ | |
282 | "-m$emul -shared -Tpic-and-nonpic-3a.ld" \ | |
283 | "$flag -EB -mips3" \ | |
284 | [list "pic-and-nonpic-6-${abi}a.s"] {} \ | |
285 | "pic-and-nonpic-6-${abi}.so"] \ | |
286 | [list "PIC and non-PIC test 6 ($abi executable)" \ | |
287 | "-m$emul -Tpic-and-nonpic-6.ld tmpdir/pic-and-nonpic-6-${abi}.so" \ | |
288 | "$flag -EB -mips3" \ | |
289 | [list "pic-and-nonpic-6-${abi}b.s" \ | |
290 | "pic-and-nonpic-6-${abi}c.s"] \ | |
291 | [list "readelf {--wide --segments} pic-and-nonpic-6-${abi}.sd" \ | |
292 | "objdump -dr pic-and-nonpic-6-${abi}.dd" \ | |
293 | "objdump {-s -j.got.plt} pic-and-nonpic-6-${abi}.pd" \ | |
294 | "readelf -A pic-and-nonpic-6-${abi}.gd" \ | |
295 | "readelf --relocs pic-and-nonpic-6-${abi}.rd" \ | |
296 | "readelf --symbols pic-and-nonpic-6-${abi}.nd" \ | |
297 | "readelf -d pic-and-nonpic-6-${abi}.ad"] \ | |
298 | "pic-and-nonpic-6-${abi}"]] | |
299 | } | |
fbf18a5c | 300 | } |
a657e7c1 | 301 | |
fbf18a5c | 302 | if { $embedded_elf } { |
fbf18a5c | 303 | run_dump_test "region1" |
a657e7c1 | 304 | } |
18ab1921 RS |
305 | |
306 | if $embedded_elf { | |
307 | # This could work on other targets too, but would need the appropriate | |
308 | # ld -m switch. | |
309 | run_dump_test "reloc-1-rel" | |
310 | } | |
311 | if $has_newabi { | |
312 | run_dump_test "reloc-1-n32" | |
313 | if $linux_gnu { | |
314 | # Uses a linux-specific ld -m switch | |
315 | run_dump_test "reloc-1-n64" | |
316 | } | |
317 | } | |
318 | run_dump_test "reloc-2" | |
17a6716a | 319 | run_dump_test "reloc-merge-lo16" |
3b788261 TS |
320 | run_dump_test "reloc-3" |
321 | if {$has_newabi} { | |
322 | run_dump_test "reloc-3-n32" | |
323 | } | |
43ec5bc0 AN |
324 | run_dump_test "reloc-4" |
325 | run_dump_test "reloc-5" | |
77c56f44 RS |
326 | if { $has_newabi } { |
327 | run_ld_link_tests { | |
328 | {"reloc test 6a" "-shared" | |
329 | "-n32" "reloc-6a.s" | |
330 | {} | |
331 | "reloc-6a.so"} | |
332 | {"reloc test 6b" "tmpdir/reloc-6a.so" | |
333 | "-n32" "reloc-6b.s" | |
334 | {} | |
335 | "reloc-6b"} | |
336 | } | |
337 | } | |
43ec5bc0 | 338 | |
353057a5 RS |
339 | if {$has_newabi && $linux_gnu} { |
340 | run_dump_test "eh-frame1-n32" | |
341 | run_dump_test "eh-frame1-n64" | |
dcf507a6 RS |
342 | run_dump_test "eh-frame2-n32" |
343 | run_dump_test "eh-frame2-n64" | |
353057a5 | 344 | } |
8c946ed5 RS |
345 | if {$embedded_elf} { |
346 | run_dump_test "eh-frame3" | |
347 | run_dump_test "eh-frame4" | |
348 | } | |
18e04883 RS |
349 | if {$linux_gnu} { |
350 | set eh_frame5_test { | |
351 | {"MIPS eh-frame 5" | |
352 | "-melf32btsmip -shared -Teh-frame5.ld" | |
353 | "-32 -EB" | |
354 | {eh-frame5.s} | |
355 | {{readelf {--relocs -wf} eh-frame5.d}} | |
356 | "eh-frame5.so"} | |
357 | } | |
358 | run_ld_link_tests $eh_frame5_test | |
359 | } | |
0efd4160 ILT |
360 | |
361 | run_dump_test "jaloverflow" | |
c314987d | 362 | run_dump_test "jaloverflow-2" |
1f0f3e9b RS |
363 | if {$has_newabi} { |
364 | run_dump_test "jalbal" | |
365 | } | |
d6f16593 | 366 | |
776167e8 CM |
367 | run_dump_test "mode-change-error-1" |
368 | ||
d6f16593 MR |
369 | run_dump_test "mips16-hilo" |
370 | if {$has_newabi} { | |
371 | run_dump_test "mips16-hilo-n32" | |
372 | } | |
f4e584bd | 373 | |
cc27e1dc | 374 | if { $linux_gnu } { |
250826bd RS |
375 | if { $has_newabi } { |
376 | run_dump_test "textrel-1" | |
377 | } | |
c224138d RS |
378 | run_dump_test "got-page-1" |
379 | if $has_newabi { | |
380 | run_dump_test "got-page-2" | |
08b55522 | 381 | run_dump_test "dyn-sec64" |
c224138d RS |
382 | } |
383 | run_dump_test "got-page-3" | |
ccb4c951 RS |
384 | run_dump_test "got-dump-1" |
385 | if $has_newabi { | |
386 | run_dump_test "got-dump-2" | |
387 | } | |
63897e2c | 388 | run_dump_test "reloc-estimate-1" |
cc27e1dc EC |
389 | } |
390 | ||
81d43bff RS |
391 | if $has_newabi { |
392 | run_dump_test "emit-relocs-1" | |
393 | } | |
394 | ||
73934d31 RS |
395 | run_dump_test "hash1a" |
396 | run_dump_test "hash1b" | |
397 | run_dump_test "hash1c" | |
398 | ||
5108fc1b RS |
399 | if {[istarget mips*-*-linux*]} { |
400 | # The number of symbols that are always included in the symbol table | |
74541ad4 | 401 | # for these tests. The 4 are: |
5108fc1b RS |
402 | # |
403 | # the null symbol entry | |
404 | # the .MIPS.stubs section symbol | |
5108fc1b RS |
405 | # _gp |
406 | # _GLOBAL_OFFSET_TABLE_ | |
74541ad4 | 407 | set base_syms 4 |
5108fc1b RS |
408 | foreach dynsym { 7fff 8000 fff0 10000 2fe80 } { |
409 | run_ld_link_tests \ | |
410 | [list [list \ | |
411 | "Stub for dynsym 0x$dynsym" \ | |
412 | "-shared -melf32btsmip -T stub-dynsym-1.ld" \ | |
413 | [concat \ | |
414 | "-EB -march=mips1 -32 -KPIC" \ | |
415 | "--defsym base_syms=$base_syms" \ | |
416 | "--defsym dynsym=0x$dynsym"] \ | |
417 | [list "stub-dynsym-1.s"] \ | |
418 | [list [list \ | |
419 | "objdump" "-dz" \ | |
420 | "stub-dynsym-1-$dynsym.d"]] \ | |
421 | "stub-dynsym-1-$dynsym"]] | |
422 | } | |
423 | } | |
424 | ||
f4e584bd DJ |
425 | # For tests which may involve multiple files, use run_ld_link_tests. |
426 | ||
427 | # List contains test-items with 3 items followed by 2 lists: | |
428 | # 0:name 1:ld options 2:assembler options | |
429 | # 3:filenames of assembler files 4: action and options. 5: name of output file | |
430 | ||
431 | # Actions: | |
432 | # objdump: Apply objdump options on result. Compare with regex (last arg). | |
433 | # nm: Apply nm options on result. Compare with regex (last arg). | |
434 | # readelf: Apply readelf options on result. Compare with regex (last arg). | |
435 | ||
436 | set mips_tls_tests { | |
437 | {"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld" | |
438 | "-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s} | |
439 | {{objdump {-dr -m mips:isa32r2} tlsbin-o32.d} {objdump -srj.got tlsbin-o32.got}} | |
440 | "tls-static-o32"} | |
441 | {"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld" | |
442 | "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} | |
443 | {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32.got}} | |
444 | "tlslib-o32.so"} | |
445 | {"Dynamic executable with TLS" | |
446 | "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so" | |
447 | "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s} | |
448 | {{objdump {-dr -m mips:isa32r2} tlsdyn-o32.d} {objdump -Rsj.got tlsdyn-o32.got}} | |
449 | "tls-dynamic-o32"} | |
450 | {"Shared library with multiple GOTs and TLS" | |
451 | "-shared -melf32btsmip -T mips-lib.ld" | |
452 | "-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s} | |
453 | {{readelf {-d -r} tls-multi-got-1.r} | |
454 | {objdump {-dr -m mips:isa32r2} tls-multi-got-1.d} | |
455 | {objdump -Rsj.got tls-multi-got-1.got}} | |
456 | "tlslib-multi.so"} | |
457 | {"Shared library with TLS and versioning" | |
458 | "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver" | |
459 | "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} | |
460 | {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-ver.got}} | |
461 | "tlslib-o32-ver.so"} | |
462 | {"Dynamic executable with TLS and versioning" | |
463 | "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so" | |
464 | "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s} | |
465 | {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-1.d} {objdump -Rsj.got tlsdyn-o32-1.got}} | |
466 | "tls-dynamic-o32-ver"} | |
467 | {"Dynamic executable with TLS and versioning (order 2)" | |
468 | "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o" | |
469 | "-EB -march=mips1 -32 -KPIC" {} | |
470 | {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-2.d} {objdump -Rsj.got tlsdyn-o32-2.got}} | |
471 | "tls-dynamic-o32-ver-2"} | |
472 | {"Dynamic executable with TLS and versioning (order 3)" | |
473 | "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o" | |
474 | "-EB -march=mips1 -32 -KPIC" {} | |
475 | {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-3.d} {objdump -Rsj.got tlsdyn-o32-3.got}} | |
476 | "tls-dynamic-o32-ver-3"} | |
477 | {"Shared library with TLS and hidden symbols" | |
478 | "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver" | |
479 | "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} | |
480 | {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}} | |
481 | "tlslib-o32-hidden.so"} | |
4005427f RS |
482 | {"Shared library with TLS and hidden symbols (2)" |
483 | "-shared -melf32btsmip -T mips-lib.ld" | |
484 | "-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s} | |
485 | {{objdump -drj.text tls-hidden2.d} {objdump -sj.got tls-hidden2-got.d}} | |
486 | "tls-hidden2.so"} | |
ead49a57 RS |
487 | {"Shared library with TLS and hidden symbols (3)" |
488 | "-shared -melf32btsmip -T tls-hidden3.ld" | |
489 | "-EB -march=mips2 -32 -KPIC" {tls-hidden3a.s tls-hidden3b.s} | |
490 | {{objdump -dj.text tls-hidden3.d} {objdump -sj.got tls-hidden3.got} | |
491 | {readelf --relocs tls-hidden3.r}} | |
492 | "tls-hidden3.so"} | |
493 | {"Shared library with TLS and hidden symbols (4)" | |
494 | "-shared -melf32btsmip -T tls-hidden3.ld" | |
495 | "-EB -march=mips2 -32 -KPIC" {tls-hidden4a.s tls-hidden4b.s} | |
496 | {{objdump -sj.got tls-hidden4.got} {readelf --relocs tls-hidden4.r}} | |
497 | "tls-hidden4.so"} | |
f4e584bd DJ |
498 | } |
499 | ||
500 | if {[istarget mips*-*-linux*]} { | |
501 | run_ld_link_tests $mips_tls_tests | |
502 | } | |
503 | ||
08e8dfaf RS |
504 | set mips16_call_global_test [list \ |
505 | [list "Global calls from mips16" \ | |
02277eae | 506 | "$o32_ld_flags -T no-shared-1.ld" \ |
08e8dfaf RS |
507 | "$o32_as_flags -mips32r2" \ |
508 | {mips16-call-global-1.s mips16-call-global-2.s mips16-call-global-3.s} \ | |
509 | {{objdump -dr mips16-call-global.d}} \ | |
510 | "mips16-call-global"]] | |
35d3d567 TS |
511 | |
512 | run_ld_link_tests $mips16_call_global_test | |
b9d58d71 | 513 | |
08e8dfaf RS |
514 | set mips16_intermix_test [list \ |
515 | [list "Intermixing mips32 and mips16 functions" \ | |
516 | "$o32_ld_flags" \ | |
517 | "$o32_as_flags -mips32r2" \ | |
518 | {mips16-intermix-1.s mips16-intermix-2.s} \ | |
519 | {{objdump -t mips16-intermix.d}} \ | |
520 | "mips16-intermix"]] | |
b9d58d71 TS |
521 | |
522 | run_ld_link_tests $mips16_intermix_test | |
b314ec0e RS |
523 | |
524 | run_dump_test "mips16-local-stubs-1" | |
2cf19d5c JM |
525 | |
526 | run_dump_test "attr-gnu-4-00" | |
527 | run_dump_test "attr-gnu-4-01" | |
528 | run_dump_test "attr-gnu-4-02" | |
529 | run_dump_test "attr-gnu-4-03" | |
42554f6a TS |
530 | run_dump_test "attr-gnu-4-04" |
531 | run_dump_test "attr-gnu-4-05" | |
2cf19d5c JM |
532 | run_dump_test "attr-gnu-4-10" |
533 | run_dump_test "attr-gnu-4-11" | |
534 | run_dump_test "attr-gnu-4-12" | |
535 | run_dump_test "attr-gnu-4-13" | |
536 | run_dump_test "attr-gnu-4-14" | |
42554f6a | 537 | run_dump_test "attr-gnu-4-15" |
2cf19d5c JM |
538 | run_dump_test "attr-gnu-4-20" |
539 | run_dump_test "attr-gnu-4-21" | |
540 | run_dump_test "attr-gnu-4-22" | |
541 | run_dump_test "attr-gnu-4-23" | |
42554f6a TS |
542 | run_dump_test "attr-gnu-4-24" |
543 | run_dump_test "attr-gnu-4-25" | |
2cf19d5c JM |
544 | run_dump_test "attr-gnu-4-30" |
545 | run_dump_test "attr-gnu-4-31" | |
546 | run_dump_test "attr-gnu-4-32" | |
547 | run_dump_test "attr-gnu-4-33" | |
42554f6a TS |
548 | run_dump_test "attr-gnu-4-34" |
549 | run_dump_test "attr-gnu-4-35" | |
550 | run_dump_test "attr-gnu-4-40" | |
2cf19d5c | 551 | run_dump_test "attr-gnu-4-41" |
42554f6a TS |
552 | run_dump_test "attr-gnu-4-42" |
553 | run_dump_test "attr-gnu-4-43" | |
554 | run_dump_test "attr-gnu-4-44" | |
555 | run_dump_test "attr-gnu-4-45" | |
556 | run_dump_test "attr-gnu-4-51" | |
634835ae RS |
557 | |
558 | if { $linux_gnu } { | |
559 | run_ld_link_tests { | |
560 | {"GOT and versioning 1" | |
561 | "-shared -melf32btsmip --version-script got-vers-1.ver" | |
562 | "-EB -mips2 -32" {got-vers-1a.s got-vers-1b.s} | |
563 | {{readelf -d got-vers-1.dd} | |
564 | {readelf --symbols got-vers-1.sd} | |
565 | {readelf --relocs got-vers-1.rd}} | |
566 | "got-vers-1.so"} | |
567 | } | |
568 | } | |
e7e2196d MR |
569 | |
570 | run_dump_test "undefined" | |
1063d8cf CF |
571 | |
572 | # Test the conversion from jr to b | |
573 | if { $linux_gnu } { | |
574 | run_dump_test "jr-to-b-1" | |
575 | run_dump_test "jr-to-b-2" | |
576 | } | |
df58fc94 RS |
577 | |
578 | # MIPS16 and microMIPS interlinking test. | |
579 | run_dump_test "mips16-and-micromips" |