Commit | Line | Data |
---|---|---|
a657e7c1 | 1 | # Expect script for MIPS ELF linker tests |
6f2750fe | 2 | # Copyright (C) 2002-2016 Free Software Foundation, Inc. |
a657e7c1 | 3 | # |
f96b4a7b NC |
4 | # This file is part of the GNU Binutils. |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify | |
a657e7c1 | 7 | # it under the terms of the GNU General Public License as published by |
f96b4a7b | 8 | # the Free Software Foundation; either version 3 of the License, or |
a657e7c1 CD |
9 | # (at your option) any later version. |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software | |
f96b4a7b NC |
18 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
19 | # MA 02110-1301, USA. | |
a657e7c1 CD |
20 | # |
21 | ||
0a44bf69 RS |
22 | if {[istarget "mips*-*-vxworks"]} { |
23 | set mipsvxtests { | |
897aea50 | 24 | {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" "" |
0a44bf69 RS |
25 | "-mips2" {vxworks1-lib.s} |
26 | {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} | |
9e3313ae | 27 | {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} |
0a44bf69 RS |
28 | "libvxworks1.so"} |
29 | {"VxWorks executable test 1 (dynamic)" \ | |
897aea50 | 30 | "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" "" |
0a44bf69 RS |
31 | "-mips2" {vxworks1.s} |
32 | {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} | |
33 | "vxworks1"} | |
34 | {"VxWorks executable test 2 (dynamic)" \ | |
897aea50 | 35 | "-Tvxworks1.ld -q --force-dynamic" "" |
0a44bf69 RS |
36 | "-mips2" {vxworks2.s} |
37 | {{readelf --segments vxworks2.sd}} | |
38 | "vxworks2"} | |
39 | {"VxWorks executable test 2 (static)" | |
897aea50 | 40 | "-Tvxworks1.ld" "" |
0a44bf69 RS |
41 | "-mips2" {vxworks2.s} |
42 | {{readelf --segments vxworks2-static.sd}} | |
43 | "vxworks2"} | |
44 | } | |
45 | run_ld_link_tests $mipsvxtests | |
46 | run_dump_test "vxworks1-static" | |
8275b357 | 47 | run_dump_test "vxworks-forced-local-1" |
0a44bf69 RS |
48 | return |
49 | } | |
50 | ||
fbf18a5c TS |
51 | if {![istarget mips*-*-*] || ![is_elf_format]} { |
52 | return | |
53 | } | |
30a2f863 | 54 | |
ef2b5578 | 55 | set has_newabi [expr [istarget *-*-irix6*] \ |
99262e37 | 56 | || [istarget mips*-*-linux*] \ |
d4a43794 | 57 | || [istarget mips*-sde-elf*] \ |
a9d58c06 AB |
58 | || [istarget mips*-mti-elf*] \ |
59 | || [istarget mips*-img-elf*]] | |
fbf18a5c TS |
60 | set linux_gnu [expr [istarget mips*-*-linux*]] |
61 | set embedded_elf [expr [istarget mips*-*-elf]] | |
30a2f863 | 62 | |
ef2b5578 | 63 | # Set defaults. |
e319abb4 | 64 | set abi_asflags(o32) "-32" |
99262e37 MR |
65 | set abi_asflags(n32) "-march=from-abi -n32 -EB" |
66 | set abi_asflags(n64) "-march=from-abi -64 -EB" | |
ef2b5578 MR |
67 | set abi_ldflags(o32) "" |
68 | set abi_ldflags(n32) -melf32bmipn32 | |
69 | set abi_ldflags(n64) -melf64bmip | |
70 | ||
71 | # Override as needed. | |
72 | if { [istarget *-*-irix6*] } { | |
73 | set abi_asflags(o32) "-32 -EB" | |
74 | set abi_ldflags(o32) -melf32bsmip | |
75 | } elseif { [istarget mips64*-linux*] } { | |
76 | set abi_asflags(o32) "-32 -EB" | |
77 | set abi_ldflags(o32) -melf32btsmip | |
78 | } elseif { [istarget mips64*-*freebsd*] } { | |
79 | set abi_asflags(o32) "-32 -EB" | |
80 | set abi_ldflags(o32) -melf32btsmip_fbsd | |
81 | } | |
d4a43794 | 82 | if { [istarget mips*-*-linux*] || [istarget mips*-sde-elf*] |
a9d58c06 | 83 | || [istarget mips*-mti-elf*] || [istarget mips*-img-elf*]} { |
ef2b5578 MR |
84 | set abi_ldflags(n32) -melf32btsmipn32 |
85 | set abi_ldflags(n64) -melf64btsmip | |
86 | } elseif { [istarget mips64*-*freebsd*] } { | |
87 | set abi_ldflags(n32) -melf32btsmipn32_fbsd | |
88 | set abi_ldflags(n64) -melf64btsmip_fbsd | |
89 | } | |
90 | ||
738e5348 RS |
91 | if { $linux_gnu } { |
92 | run_ld_link_tests [list \ | |
93 | [list "Dummy shared library for MIPS16 PIC test 1" \ | |
897aea50 | 94 | "-shared -melf32btsmip" "" \ |
3c0bfb2a RS |
95 | "-EB -32 -mips1" \ |
96 | { mips16-pic-1-dummy.s } \ | |
738e5348 RS |
97 | {} \ |
98 | "mips16-pic-1-dummy.so"] \ | |
99 | [list "MIPS16 PIC test 1" \ | |
897aea50 | 100 | "-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-1-dummy.so" "" \ |
3c0bfb2a RS |
101 | "-EB -32 -mips1 -I $srcdir/$subdir" \ |
102 | { mips16-pic-1a.s mips16-pic-1b.s } \ | |
738e5348 RS |
103 | { { objdump { -dr -j.text } mips16-pic-1.dd } |
104 | { readelf -A mips16-pic-1.gd } } \ | |
105 | "mips16-pic-1"] \ | |
106 | [list "MIPS16 PIC test 2" \ | |
897aea50 | 107 | "-melf32btsmip -T mips16-pic-1.ld -shared" "" \ |
3c0bfb2a RS |
108 | "-EB -32 -mips1 -I $srcdir/$subdir" \ |
109 | { mips16-pic-2a.s mips16-pic-2b.s } \ | |
738e5348 RS |
110 | { { objdump { -dr -j.text } mips16-pic-2.dd } \ |
111 | { readelf -A mips16-pic-2.gd } \ | |
112 | { readelf --symbols mips16-pic-2.nd } \ | |
113 | { readelf --relocs mips16-pic-2.rd } \ | |
114 | { readelf -d mips16-pic-2.ad } } \ | |
861fb55a DJ |
115 | "mips16-pic-2"] \ |
116 | [list "MIPS16 PIC test 3" \ | |
897aea50 | 117 | "-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-1-dummy.so" "" \ |
3c0bfb2a RS |
118 | "-EB -32 -mips1 -I $srcdir/$subdir" \ |
119 | { mips16-pic-3a.s mips16-pic-3b.s } \ | |
861fb55a DJ |
120 | { { objdump -dr mips16-pic-3.dd } \ |
121 | { readelf --relocs mips16-pic-3.rd } \ | |
122 | { readelf -A mips16-pic-3.gd } } \ | |
61b0a4af RS |
123 | "mips16-pic-3"] \ |
124 | [list "MIPS16 PIC test 4 (shared library)" \ | |
897aea50 | 125 | "-shared -melf32btsmip -T mips16-pic-1.ld --version-script mips16-pic-4.ver" "" \ |
3c0bfb2a RS |
126 | "-EB -32 -mips1" \ |
127 | { mips16-pic-4a.s mips16-pic-4b.s } \ | |
61b0a4af RS |
128 | { { objdump -dr mips16-pic-4a.dd } \ |
129 | { readelf --symbols mips16-pic-4a.nd } \ | |
130 | { readelf -A mips16-pic-4a.gd } } \ | |
131 | "mips16-pic-4.so"] \ | |
132 | [list "MIPS16 PIC test 4 (executable)" \ | |
897aea50 | 133 | "-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-4.so" "" \ |
3c0bfb2a RS |
134 | "-EB -32 -mips1" \ |
135 | { mips16-pic-4c.s } \ | |
61b0a4af RS |
136 | { { objdump -dr mips16-pic-4b.dd } } \ |
137 | "mips16-pic-4"]] | |
738e5348 RS |
138 | } |
139 | ||
fbf18a5c TS |
140 | # Check MIPS16 markings being passed through link. |
141 | run_dump_test "mips16-1" | |
8914585c | 142 | |
fbf18a5c TS |
143 | # MIPS branch offset final link checking. |
144 | run_dump_test "branch-misc-1" | |
6f50d611 | 145 | run_dump_test "branch-misc-2" |
7d6c7577 | 146 | |
c9775dde MR |
147 | run_dump_test "mips16-branch-2" [list [list ld $abi_ldflags(o32)]] |
148 | run_dump_test "mips16-branch-3" [list [list ld $abi_ldflags(o32)]] | |
149 | run_dump_test "mips16-branch-addend-2" [list [list ld $abi_ldflags(o32)]] | |
150 | run_dump_test "mips16-branch-addend-3" [list [list ld $abi_ldflags(o32)]] | |
151 | ||
df58fc94 RS |
152 | # Jalx test |
153 | run_dump_test "jalx-1" | |
154 | ||
155 | if { $linux_gnu } { | |
156 | run_ld_link_tests [list \ | |
157 | [list "Dummy shared library for JALX test 2" \ | |
897aea50 | 158 | "-shared -nostdlib -melf32btsmip" "" \ |
df58fc94 RS |
159 | "-G0 -EB -mmicromips -no-mdebug -mabi=32 -march=mips32r2 -KPIC" \ |
160 | { jalx-2-printf.s } \ | |
161 | {} \ | |
162 | "libjalx-2.so"] \ | |
163 | [list "Dummy external function for JALX test 2" \ | |
897aea50 | 164 | "-r -melf32btsmip" "" \ |
df58fc94 RS |
165 | "-G0 -EB -no-mdebug -mabi=32 -march=mips32r2 -mno-shared -call_nonpic" \ |
166 | { jalx-2-ex.s } \ | |
167 | {} \ | |
168 | "jalx-2-ex.o.r"] \ | |
169 | [list "MIPS JALX test 2" \ | |
897aea50 | 170 | "-nostdlib -T jalx-2.ld tmpdir/libjalx-2.so tmpdir/jalx-2-ex.o.r -melf32btsmip" "" \ |
df58fc94 RS |
171 | "-G0 -EB -mmicromips -no-mdebug -mabi=32 -march=mips32r2 -mno-shared -call_nonpic" \ |
172 | { jalx-2-main.s } \ | |
173 | { { objdump -d jalx-2.dd } } \ | |
174 | "jalx-2"]] | |
175 | } | |
176 | ||
17c6c9d9 | 177 | run_dump_test "jalx-addend" [list [list ld $abi_ldflags(o32)]] |
44d3da23 | 178 | run_dump_test "jalx-local" [list [list ld $abi_ldflags(o32)]] |
17c6c9d9 MR |
179 | if $has_newabi { |
180 | run_dump_test "jalx-addend-n32" [list [list ld $abi_ldflags(n32)]] | |
44d3da23 | 181 | run_dump_test "jalx-local-n32" [list [list ld $abi_ldflags(n32)]] |
17c6c9d9 | 182 | run_dump_test "jalx-addend-n64" [list [list ld $abi_ldflags(n64)]] |
44d3da23 | 183 | run_dump_test "jalx-local-n64" [list [list ld $abi_ldflags(n64)]] |
17c6c9d9 MR |
184 | } |
185 | ||
de341542 MR |
186 | run_dump_test "unaligned-jalx-0" [list [list ld $abi_ldflags(o32)]] |
187 | run_dump_test "unaligned-jalx-1" [list [list ld $abi_ldflags(o32)]] | |
de341542 MR |
188 | run_dump_test "unaligned-jalx-mips16-0" [list [list ld $abi_ldflags(o32)]] |
189 | run_dump_test "unaligned-jalx-mips16-1" [list [list ld $abi_ldflags(o32)]] | |
de341542 MR |
190 | run_dump_test "unaligned-jalx-micromips-0" [list [list ld $abi_ldflags(o32)]] |
191 | run_dump_test "unaligned-jalx-micromips-1" [list [list ld $abi_ldflags(o32)]] | |
de341542 | 192 | |
bc27bb05 MR |
193 | if $has_newabi { |
194 | run_dump_test "unaligned-jalx-addend-0" \ | |
195 | [list [list ld $abi_ldflags(n32)]] | |
196 | run_dump_test "unaligned-jalx-addend-1" \ | |
197 | [list [list ld $abi_ldflags(n32)]] | |
198 | run_dump_test "unaligned-jalx-addend-mips16-0" \ | |
199 | [list [list ld $abi_ldflags(n32)]] | |
200 | run_dump_test "unaligned-jalx-addend-mips16-1" \ | |
201 | [list [list ld $abi_ldflags(n32)]] | |
202 | run_dump_test "unaligned-jalx-addend-micromips-0" \ | |
203 | [list [list ld $abi_ldflags(n32)]] | |
204 | run_dump_test "unaligned-jalx-addend-micromips-1" \ | |
205 | [list [list ld $abi_ldflags(n32)]] | |
206 | } | |
207 | ||
99aefae6 MR |
208 | run_dump_test "unaligned-branch" [list [list ld $abi_ldflags(o32)]] |
209 | ||
de341542 MR |
210 | run_dump_test "unaligned-lwpc-0" [list [list ld $abi_ldflags(o32)]] |
211 | run_dump_test "unaligned-lwpc-1" [list [list ld $abi_ldflags(o32)]] | |
de341542 MR |
212 | run_dump_test "unaligned-ldpc-0" [list [list ld $abi_ldflags(o32)]] |
213 | run_dump_test "unaligned-ldpc-1" [list [list ld $abi_ldflags(o32)]] | |
de341542 | 214 | |
732be173 DJ |
215 | # Test multi-got link. We only do this on GNU/Linux because it requires |
216 | # the "traditional" emulations. | |
217 | if { $linux_gnu } { | |
218 | run_dump_test "multi-got-1" | |
bbe506e8 | 219 | run_dump_test "multi-got-no-shared" |
2152e047 DJ |
220 | run_dump_test "multi-got-hidden-1" |
221 | run_dump_test "multi-got-hidden-2" | |
732be173 | 222 | } |
30a2f863 | 223 | |
0a61c8c2 RS |
224 | # Test __gnu_local_gp accesses |
225 | if { $linux_gnu } { | |
226 | run_dump_test "no-shared-1-o32" | |
227 | if { $has_newabi } { | |
228 | run_dump_test "no-shared-1-n32" | |
229 | run_dump_test "no-shared-1-n64" | |
230 | } | |
231 | } | |
232 | ||
a5499fa4 MF |
233 | # Test PIE debug dynamic tags |
234 | if { $linux_gnu } { | |
235 | run_dump_test "pie-o32" | |
236 | if { $has_newabi } { | |
237 | run_dump_test "pie-n32" | |
238 | run_dump_test "pie-n64" | |
239 | } | |
240 | } | |
241 | ||
fbf18a5c | 242 | if $has_newabi { |
ef2b5578 MR |
243 | if { $embedded_elf } { |
244 | run_dump_test "elf-rel-got-n32-embed" \ | |
245 | [list [list ld $abi_ldflags(n32)]] | |
246 | run_dump_test "elf-rel-xgot-n32-embed" \ | |
247 | [list [list ld $abi_ldflags(n32)]] | |
248 | } else { | |
249 | run_dump_test "elf-rel-got-n32" [list [list ld $abi_ldflags(n32)]] | |
250 | run_dump_test "elf-rel-xgot-n32" [list [list ld $abi_ldflags(n32)]] | |
251 | } | |
48fe7bda | 252 | if { $linux_gnu } { |
ef2b5578 MR |
253 | run_dump_test "elf-rel-got-n64-linux" \ |
254 | [list [list ld $abi_ldflags(n64)]] | |
255 | run_dump_test "elf-rel-xgot-n64-linux" \ | |
256 | [list [list ld $abi_ldflags(n64)]] | |
257 | } elseif { $embedded_elf } { | |
258 | run_dump_test "elf-rel-got-n64-embed" \ | |
259 | [list [list ld $abi_ldflags(n64)]] | |
260 | run_dump_test "elf-rel-xgot-n64-embed" \ | |
261 | [list [list ld $abi_ldflags(n64)]] | |
fbf18a5c | 262 | } else { |
ef2b5578 MR |
263 | run_dump_test "elf-rel-got-n64" [list [list ld $abi_ldflags(n64)]] |
264 | run_dump_test "elf-rel-xgot-n64" [list [list ld $abi_ldflags(n64)]] | |
48fe7bda AO |
265 | } |
266 | ||
fbf18a5c TS |
267 | run_dump_test "relax-jalr-n32" |
268 | run_dump_test "relax-jalr-n32-shared" | |
269 | run_dump_test "relax-jalr-n64" | |
270 | run_dump_test "relax-jalr-n64-shared" | |
271 | } | |
48fe7bda | 272 | |
fbf18a5c TS |
273 | if { $linux_gnu } { |
274 | run_dump_test "rel32-o32" | |
250826bd RS |
275 | if { $has_newabi } { |
276 | run_dump_test "rel32-n32" | |
277 | run_dump_test "rel64" | |
278 | } | |
861fb55a DJ |
279 | # The first test checks that a mixed PIC/non-PIC relocatable link |
280 | # will not introduce any stubs itself, but will flag PIC functions | |
281 | # for the final link. | |
282 | # | |
283 | # The second test checks that we insert stubs for calls from | |
284 | # non-PIC functions to PIC functions when linking the original | |
285 | # two objects together. | |
286 | # | |
287 | # The third test checks that we do the same when linking the | |
288 | # result of the first link (with no other source files). | |
289 | run_ld_link_tests { | |
897aea50 | 290 | {"PIC and non-PIC test 1 (relocatable)" "-r -melf32btsmip" "" |
861fb55a DJ |
291 | "-32 -EB -mips2" {pic-and-nonpic-1a.s pic-and-nonpic-1b.s} |
292 | {{objdump -dr pic-and-nonpic-1-rel.dd} | |
293 | {readelf --symbols pic-and-nonpic-1-rel.nd}} | |
294 | "pic-and-nonpic-1-rel.o"} | |
295 | {"PIC and non-PIC test 1 (static 1)" | |
897aea50 | 296 | "-melf32btsmip -Tpic-and-nonpic-1.ld" "" |
861fb55a DJ |
297 | "-32 -EB -mips2" {pic-and-nonpic-1a.s pic-and-nonpic-1b.s} |
298 | {{objdump -dr pic-and-nonpic-1.dd} | |
299 | {readelf --symbols pic-and-nonpic-1.nd}} | |
300 | "pic-and-nonpic-1-static1.o"} | |
301 | {"PIC and non-PIC test 1 (static 2)" | |
897aea50 | 302 | "-melf32btsmip -Tpic-and-nonpic-1.ld tmpdir/pic-and-nonpic-1-rel.o" "" |
861fb55a DJ |
303 | "" {} |
304 | {{objdump -dr pic-and-nonpic-1.dd} | |
305 | {readelf --symbols pic-and-nonpic-1.nd}} | |
306 | "pic-and-nonpic-1-static2.o"} | |
307 | } | |
308 | run_dump_test "pic-and-nonpic-2" | |
309 | run_ld_link_tests { | |
310 | {"PIC and non-PIC test 3 (shared library)" | |
897aea50 | 311 | "-melf32btsmip -shared -Tpic-and-nonpic-3a.ld" "" |
861fb55a DJ |
312 | "-32 -EB -mips2" {pic-and-nonpic-3a.s} |
313 | {{readelf --segments pic-and-nonpic-3a.sd} | |
314 | {readelf -A pic-and-nonpic-3a.gd} | |
315 | {objdump -dr pic-and-nonpic-3a.dd}} | |
316 | "pic-and-nonpic-3a.so"} | |
317 | {"PIC and non-PIC test 3 (executable)" | |
897aea50 | 318 | "-melf32btsmip -Tpic-and-nonpic-3b.ld tmpdir/pic-and-nonpic-3a.so" "" |
861fb55a DJ |
319 | "-32 -EB -mips2" {pic-and-nonpic-3b.s} |
320 | {{readelf --segments pic-and-nonpic-3b.sd} | |
321 | {objdump -dr pic-and-nonpic-3b.dd} | |
322 | {objdump {-s -j.got.plt} pic-and-nonpic-3b.pd} | |
323 | {readelf -A pic-and-nonpic-3b.gd} | |
324 | {readelf --relocs pic-and-nonpic-3b.rd} | |
325 | {readelf --symbols pic-and-nonpic-3b.nd} | |
326 | {readelf -d pic-and-nonpic-3b.ad}} | |
327 | "pic-and-nonpic-3b"} | |
328 | } | |
329 | run_dump_test "pic-and-nonpic-3-error" | |
330 | run_ld_link_tests { | |
331 | {"PIC and non-PIC test 4 (shared library)" | |
897aea50 | 332 | "-melf32btsmip -shared -Tpic-and-nonpic-3a.ld" "" |
861fb55a DJ |
333 | "-32 -EB -mips2" {pic-and-nonpic-4a.s} |
334 | {} | |
335 | "pic-and-nonpic-4a.so"} | |
336 | {"PIC and non-PIC test 4 (executable)" | |
897aea50 | 337 | "-melf32btsmip -Tpic-and-nonpic-4b.ld tmpdir/pic-and-nonpic-4a.so" "" |
861fb55a DJ |
338 | "-32 -EB -mips2" {pic-and-nonpic-4b.s} |
339 | {{readelf --segments pic-and-nonpic-4b.sd} | |
340 | {objdump -dr pic-and-nonpic-4b.dd} | |
341 | {objdump {-s -j.got -j.data} pic-and-nonpic-4b.gd} | |
342 | {readelf --relocs pic-and-nonpic-4b.rd} | |
343 | {readelf --symbols pic-and-nonpic-4b.nd} | |
344 | {readelf -d pic-and-nonpic-4b.ad}} | |
345 | "pic-and-nonpic-4b"} | |
346 | } | |
347 | run_dump_test "pic-and-nonpic-4-error" | |
348 | run_ld_link_tests { | |
349 | {"PIC and non-PIC test 5 (executable)" | |
897aea50 | 350 | "-melf32btsmip -Tpic-and-nonpic-5b.ld tmpdir/pic-and-nonpic-3a.so tmpdir/pic-and-nonpic-4a.so" "" |
861fb55a DJ |
351 | "-32 -EB -mips2" {pic-and-nonpic-5a.s pic-and-nonpic-5b.s} |
352 | {{readelf --segments pic-and-nonpic-5b.sd} | |
353 | {objdump -dr pic-and-nonpic-5b.dd} | |
354 | {objdump {-s -j.got.plt -j.data} pic-and-nonpic-5b.pd} | |
355 | {readelf -A pic-and-nonpic-5b.gd} | |
356 | {readelf --relocs pic-and-nonpic-5b.rd} | |
357 | {readelf --symbols pic-and-nonpic-5b.nd} | |
358 | {readelf -d pic-and-nonpic-5b.ad}} | |
359 | "pic-and-nonpic-5b"} | |
360 | } | |
361 | set abis { o32 -32 elf32btsmip } | |
362 | if $has_newabi { | |
363 | lappend abis n32 -n32 elf32btsmipn32 | |
364 | lappend abis n64 -64 elf64btsmip | |
365 | } | |
366 | foreach { abi flag emul } $abis { | |
367 | run_ld_link_tests [list \ | |
368 | [list "PIC and non-PIC test 6 ($abi shared library)" \ | |
897aea50 | 369 | "-m$emul -shared -Tpic-and-nonpic-3a.ld" "" \ |
861fb55a DJ |
370 | "$flag -EB -mips3" \ |
371 | [list "pic-and-nonpic-6-${abi}a.s"] {} \ | |
372 | "pic-and-nonpic-6-${abi}.so"] \ | |
373 | [list "PIC and non-PIC test 6 ($abi executable)" \ | |
897aea50 | 374 | "-m$emul -Tpic-and-nonpic-6.ld tmpdir/pic-and-nonpic-6-${abi}.so" "" \ |
861fb55a DJ |
375 | "$flag -EB -mips3" \ |
376 | [list "pic-and-nonpic-6-${abi}b.s" \ | |
377 | "pic-and-nonpic-6-${abi}c.s"] \ | |
378 | [list "readelf {--wide --segments} pic-and-nonpic-6-${abi}.sd" \ | |
379 | "objdump -dr pic-and-nonpic-6-${abi}.dd" \ | |
380 | "objdump {-s -j.got.plt} pic-and-nonpic-6-${abi}.pd" \ | |
381 | "readelf -A pic-and-nonpic-6-${abi}.gd" \ | |
382 | "readelf --relocs pic-and-nonpic-6-${abi}.rd" \ | |
383 | "readelf --symbols pic-and-nonpic-6-${abi}.nd" \ | |
384 | "readelf -d pic-and-nonpic-6-${abi}.ad"] \ | |
385 | "pic-and-nonpic-6-${abi}"]] | |
43b5366b MR |
386 | |
387 | # This checks whether our linker scripts get the scope of _gp right, | |
388 | # and must therefore use default scripts. If they don't, then -- in | |
389 | # addition to dumps failing to match -- the final link fails with: | |
390 | # | |
391 | # ld: gp-hidden.o: undefined reference to symbol '_gp' | |
392 | # ld: note: '_gp' is defined in DSO ./tmpdir/gp-hidden-lib-${abi}.so | |
393 | # so try adding it to the linker command line | |
394 | # | |
395 | set suff64 [string map {o32 "" n32 "" n64 -64} $abi] | |
396 | run_ld_link_tests [list \ | |
397 | [list \ | |
398 | "_gp scope test ($abi shared library)" \ | |
897aea50 | 399 | "$abi_ldflags($abi) -shared" "" \ |
43b5366b MR |
400 | "$abi_asflags($abi) -KPIC" \ |
401 | { gp-hidden-lib.s } \ | |
402 | [list \ | |
403 | "readelf --relocs gp-hidden-lib${suff64}.rd" \ | |
404 | "readelf --syms gp-hidden.sd"] \ | |
405 | "gp-hidden-lib-${abi}.so"] \ | |
406 | [list \ | |
407 | "_gp scope test ($abi versioned library)" \ | |
897aea50 | 408 | "$abi_ldflags($abi) -shared -version-script gp-hidden-ver.ver tmpdir/gp-hidden-lib-${abi}.so" "" \ |
43b5366b MR |
409 | "$abi_asflags($abi) -KPIC" \ |
410 | { gp-hidden-ver.s } \ | |
411 | [list \ | |
412 | "readelf --relocs gp-hidden-ver${suff64}.rd" \ | |
413 | "readelf --syms gp-hidden.sd"] \ | |
414 | "gp-hidden-ver-${abi}.so"] \ | |
415 | [list \ | |
416 | "_gp scope test ($abi executable)" \ | |
897aea50 | 417 | "$abi_ldflags($abi) -e 0 -rpath-link . tmpdir/gp-hidden-ver-${abi}.so" "" \ |
43b5366b MR |
418 | "$abi_asflags($abi) -call_nonpic" \ |
419 | { gp-hidden.s } \ | |
420 | [list \ | |
421 | "readelf --relocs gp-hidden${suff64}.rd" \ | |
422 | "readelf --syms gp-hidden.sd"] \ | |
423 | "gp-hidden-${abi}"]] | |
861fb55a | 424 | } |
fbf18a5c | 425 | } |
a657e7c1 | 426 | |
fbf18a5c | 427 | if { $embedded_elf } { |
fbf18a5c | 428 | run_dump_test "region1" |
a657e7c1 | 429 | } |
18ab1921 RS |
430 | |
431 | if $embedded_elf { | |
432 | # This could work on other targets too, but would need the appropriate | |
433 | # ld -m switch. | |
434 | run_dump_test "reloc-1-rel" | |
435 | } | |
436 | if $has_newabi { | |
ef2b5578 MR |
437 | run_dump_test "reloc-1-n32" [list [list ld $abi_ldflags(n32)]] |
438 | run_dump_test "reloc-1-n64" [list [list ld $abi_ldflags(n64)]] | |
18ab1921 RS |
439 | } |
440 | run_dump_test "reloc-2" | |
17a6716a | 441 | run_dump_test "reloc-merge-lo16" |
3b788261 TS |
442 | run_dump_test "reloc-3" |
443 | if {$has_newabi} { | |
444 | run_dump_test "reloc-3-n32" | |
445 | } | |
43ec5bc0 AN |
446 | run_dump_test "reloc-4" |
447 | run_dump_test "reloc-5" | |
77c56f44 | 448 | if { $has_newabi } { |
ef2b5578 MR |
449 | run_ld_link_tests [list \ |
450 | [list \ | |
451 | "reloc test 6a" \ | |
897aea50 | 452 | "-shared $abi_ldflags(n32)" "" \ |
cde00cbb | 453 | "$abi_asflags(n32)" \ |
ef2b5578 MR |
454 | "reloc-6a.s" \ |
455 | {} \ | |
456 | "reloc-6a.so"] \ | |
457 | [list \ | |
458 | "reloc test 6b" \ | |
897aea50 | 459 | "$abi_ldflags(n32) tmpdir/reloc-6a.so" "" \ |
cde00cbb | 460 | "$abi_asflags(n32)" \ |
ef2b5578 MR |
461 | "reloc-6b.s" \ |
462 | {} \ | |
463 | "reloc-6b"]] | |
77c56f44 | 464 | } |
43ec5bc0 | 465 | |
ceab86af MR |
466 | run_dump_test "reloc-local-overflow" [list [list ld $abi_ldflags(o32)]] |
467 | ||
353057a5 RS |
468 | if {$has_newabi && $linux_gnu} { |
469 | run_dump_test "eh-frame1-n32" | |
470 | run_dump_test "eh-frame1-n64" | |
dcf507a6 RS |
471 | run_dump_test "eh-frame2-n32" |
472 | run_dump_test "eh-frame2-n64" | |
353057a5 | 473 | } |
8c946ed5 RS |
474 | if {$embedded_elf} { |
475 | run_dump_test "eh-frame3" | |
476 | run_dump_test "eh-frame4" | |
477 | } | |
18e04883 RS |
478 | if {$linux_gnu} { |
479 | set eh_frame5_test { | |
480 | {"MIPS eh-frame 5" | |
897aea50 | 481 | "-melf32btsmip -shared -Teh-frame5.ld" "" |
18e04883 RS |
482 | "-32 -EB" |
483 | {eh-frame5.s} | |
484 | {{readelf {--relocs -wf} eh-frame5.d}} | |
485 | "eh-frame5.so"} | |
486 | } | |
487 | run_ld_link_tests $eh_frame5_test | |
488 | } | |
0efd4160 | 489 | |
2f0c68f2 CM |
490 | if {$embedded_elf} { |
491 | run_dump_test "compact-eh1" | |
492 | run_dump_test "compact-eh2" | |
493 | run_dump_test "compact-eh3" | |
494 | } | |
495 | ||
496 | if {$linux_gnu} { | |
497 | run_dump_test "compact-eh4" | |
498 | run_dump_test "compact-eh5" | |
499 | run_dump_test "compact-eh6" | |
500 | } | |
501 | ||
0efd4160 | 502 | run_dump_test "jaloverflow" |
c314987d | 503 | run_dump_test "jaloverflow-2" |
77434823 MR |
504 | |
505 | run_dump_test "jal-global-overflow-0" [list [list ld $abi_ldflags(o32)]] | |
506 | run_dump_test "jal-global-overflow-1" [list [list ld $abi_ldflags(o32)]] | |
507 | run_dump_test "jal-local-overflow-0" [list [list ld $abi_ldflags(o32)]] | |
508 | run_dump_test "jal-local-overflow-1" [list [list ld $abi_ldflags(o32)]] | |
509 | ||
6e8ec712 MF |
510 | run_dump_test "undefweak-overflow" [list [list as $abi_asflags(o32)] \ |
511 | [list ld $abi_ldflags(o32)]] | |
538baf8b AB |
512 | |
513 | if {$has_newabi} { | |
4861b804 MR |
514 | run_dump_test "undefweak-overflow" [list [list name (n32)] \ |
515 | [list as $abi_asflags(n32)] \ | |
6e8ec712 | 516 | [list ld $abi_ldflags(n32)]] |
4861b804 MR |
517 | run_dump_test "undefweak-overflow" [list [list name (n64)] \ |
518 | [list as $abi_asflags(n64)] \ | |
6e8ec712 | 519 | [list ld $abi_ldflags(n64)]] |
538baf8b AB |
520 | } |
521 | ||
1f0f3e9b | 522 | if {$has_newabi} { |
ef2b5578 | 523 | run_dump_test "jalbal" [list [list ld $abi_ldflags(n32)]] |
1f0f3e9b | 524 | } |
d6f16593 | 525 | |
776167e8 CM |
526 | run_dump_test "mode-change-error-1" |
527 | ||
d6f16593 MR |
528 | run_dump_test "mips16-hilo" |
529 | if {$has_newabi} { | |
530 | run_dump_test "mips16-hilo-n32" | |
531 | } | |
f4e584bd | 532 | |
cc27e1dc | 533 | if { $linux_gnu } { |
250826bd RS |
534 | if { $has_newabi } { |
535 | run_dump_test "textrel-1" | |
536 | } | |
c224138d RS |
537 | run_dump_test "got-page-1" |
538 | if $has_newabi { | |
539 | run_dump_test "got-page-2" | |
08b55522 | 540 | run_dump_test "dyn-sec64" |
c224138d RS |
541 | } |
542 | run_dump_test "got-page-3" | |
13db6b44 RS |
543 | run_ld_link_tests [subst { |
544 | {"GOT page 4 (one file)" "-shared $abi_ldflags(o32) -T got-page-1.ld" | |
897aea50 | 545 | "" "$abi_asflags(o32) -mips2" {got-page-4b.s} |
13db6b44 RS |
546 | {{objdump -dr got-page-4a.d} |
547 | {readelf -A got-page-4a.got}} | |
548 | "got-page-4a.so"} | |
549 | {"GOT page 4 (two files)" "-shared $abi_ldflags(o32) -T got-page-1.ld" | |
897aea50 | 550 | "" "$abi_asflags(o32) -mips2" {got-page-4a.s got-page-4b.s} |
13db6b44 RS |
551 | {{objdump -dr got-page-4b.d} |
552 | {readelf -A got-page-4b.got}} | |
553 | "got-page-4b.so"} | |
554 | }] | |
555 | if $has_newabi { | |
556 | run_ld_link_tests [subst { | |
557 | {"GOT page 5" "-shared $abi_ldflags(n32) -T got-page-1.ld" | |
897aea50 | 558 | "" "$abi_asflags(n32)" {got-page-5.s} |
13db6b44 RS |
559 | {{objdump -dr got-page-5.d} |
560 | {readelf -A got-page-5.got}} | |
561 | "got-page-5.so"} | |
562 | {"GOT page 6" "-shared $abi_ldflags(n32) -T got-page-1.ld" | |
897aea50 | 563 | "" "$abi_asflags(n32)" {got-page-6.s} |
13db6b44 RS |
564 | {{objdump -dr got-page-6.d} |
565 | {readelf -A got-page-6.got}} | |
566 | "got-page-6.so"} | |
567 | {"GOT page 7 (order 1)" "-shared $abi_ldflags(n32) -T got-page-1.ld" | |
897aea50 | 568 | "" "$abi_asflags(n32)" |
13db6b44 RS |
569 | {got-page-7a.s got-page-7b.s got-page-7c.s got-page-7d.s |
570 | got-page-7e.s} | |
571 | {{objdump -dr got-page-7.d} | |
572 | {readelf -A got-page-7.got}} | |
573 | "got-page-7a.so"} | |
574 | {"GOT page 7 (order 2)" "-shared $abi_ldflags(n32) -T got-page-1.ld" | |
897aea50 | 575 | "" "$abi_asflags(n32)" |
13db6b44 RS |
576 | {got-page-7e.s got-page-7a.s got-page-7b.s got-page-7c.s |
577 | got-page-7d.s} | |
578 | {{objdump -dr got-page-7.d} | |
579 | {readelf -A got-page-7.got}} | |
580 | "got-page-7b.so"} | |
581 | }] | |
582 | } | |
ccb4c951 RS |
583 | run_dump_test "got-dump-1" |
584 | if $has_newabi { | |
585 | run_dump_test "got-dump-2" | |
586 | } | |
63897e2c | 587 | run_dump_test "reloc-estimate-1" |
cc27e1dc EC |
588 | } |
589 | ||
81d43bff RS |
590 | if $has_newabi { |
591 | run_dump_test "emit-relocs-1" | |
592 | } | |
593 | ||
73934d31 RS |
594 | run_dump_test "hash1a" |
595 | run_dump_test "hash1b" | |
596 | run_dump_test "hash1c" | |
597 | ||
5108fc1b RS |
598 | if {[istarget mips*-*-linux*]} { |
599 | # The number of symbols that are always included in the symbol table | |
74541ad4 | 600 | # for these tests. The 4 are: |
5108fc1b RS |
601 | # |
602 | # the null symbol entry | |
603 | # the .MIPS.stubs section symbol | |
2f9efdfc | 604 | set base_syms 2 |
5108fc1b RS |
605 | foreach dynsym { 7fff 8000 fff0 10000 2fe80 } { |
606 | run_ld_link_tests \ | |
607 | [list [list \ | |
608 | "Stub for dynsym 0x$dynsym" \ | |
897aea50 | 609 | "-shared -melf32btsmip -T stub-dynsym-1.ld" "" \ |
5108fc1b RS |
610 | [concat \ |
611 | "-EB -march=mips1 -32 -KPIC" \ | |
612 | "--defsym base_syms=$base_syms" \ | |
613 | "--defsym dynsym=0x$dynsym"] \ | |
614 | [list "stub-dynsym-1.s"] \ | |
615 | [list [list \ | |
616 | "objdump" "-dz" \ | |
617 | "stub-dynsym-1-$dynsym.d"]] \ | |
618 | "stub-dynsym-1-$dynsym"]] | |
619 | } | |
620 | } | |
621 | ||
f4e584bd DJ |
622 | # For tests which may involve multiple files, use run_ld_link_tests. |
623 | ||
624 | # List contains test-items with 3 items followed by 2 lists: | |
897aea50 MR |
625 | # 0:name 1:ld early options 2:ld late options 3:assembler options |
626 | # 4:filenames of assembler files 5: action and options. 6: name of output file | |
f4e584bd DJ |
627 | |
628 | # Actions: | |
629 | # objdump: Apply objdump options on result. Compare with regex (last arg). | |
630 | # nm: Apply nm options on result. Compare with regex (last arg). | |
631 | # readelf: Apply readelf options on result. Compare with regex (last arg). | |
632 | ||
633 | set mips_tls_tests { | |
897aea50 | 634 | {"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld" "" |
f4e584bd DJ |
635 | "-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s} |
636 | {{objdump {-dr -m mips:isa32r2} tlsbin-o32.d} {objdump -srj.got tlsbin-o32.got}} | |
637 | "tls-static-o32"} | |
897aea50 | 638 | {"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld" "" |
f4e584bd DJ |
639 | "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} |
640 | {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32.got}} | |
641 | "tlslib-o32.so"} | |
642 | {"Dynamic executable with TLS" | |
897aea50 | 643 | "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so" "" |
f4e584bd DJ |
644 | "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s} |
645 | {{objdump {-dr -m mips:isa32r2} tlsdyn-o32.d} {objdump -Rsj.got tlsdyn-o32.got}} | |
646 | "tls-dynamic-o32"} | |
647 | {"Shared library with multiple GOTs and TLS" | |
897aea50 | 648 | "-shared -melf32btsmip -T mips-lib.ld" "" |
f4e584bd DJ |
649 | "-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s} |
650 | {{readelf {-d -r} tls-multi-got-1.r} | |
651 | {objdump {-dr -m mips:isa32r2} tls-multi-got-1.d} | |
652 | {objdump -Rsj.got tls-multi-got-1.got}} | |
653 | "tlslib-multi.so"} | |
654 | {"Shared library with TLS and versioning" | |
897aea50 | 655 | "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver" "" |
f4e584bd DJ |
656 | "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} |
657 | {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-ver.got}} | |
658 | "tlslib-o32-ver.so"} | |
659 | {"Dynamic executable with TLS and versioning" | |
897aea50 | 660 | "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so" "" |
f4e584bd DJ |
661 | "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s} |
662 | {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-1.d} {objdump -Rsj.got tlsdyn-o32-1.got}} | |
663 | "tls-dynamic-o32-ver"} | |
664 | {"Dynamic executable with TLS and versioning (order 2)" | |
897aea50 | 665 | "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o" "" |
f4e584bd DJ |
666 | "-EB -march=mips1 -32 -KPIC" {} |
667 | {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-2.d} {objdump -Rsj.got tlsdyn-o32-2.got}} | |
668 | "tls-dynamic-o32-ver-2"} | |
669 | {"Dynamic executable with TLS and versioning (order 3)" | |
897aea50 | 670 | "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o" "" |
f4e584bd DJ |
671 | "-EB -march=mips1 -32 -KPIC" {} |
672 | {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-3.d} {objdump -Rsj.got tlsdyn-o32-3.got}} | |
673 | "tls-dynamic-o32-ver-3"} | |
674 | {"Shared library with TLS and hidden symbols" | |
897aea50 | 675 | "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver" "" |
f4e584bd DJ |
676 | "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} |
677 | {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}} | |
678 | "tlslib-o32-hidden.so"} | |
4005427f | 679 | {"Shared library with TLS and hidden symbols (2)" |
897aea50 | 680 | "-shared -melf32btsmip -T mips-lib.ld" "" |
4005427f RS |
681 | "-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s} |
682 | {{objdump -drj.text tls-hidden2.d} {objdump -sj.got tls-hidden2-got.d}} | |
683 | "tls-hidden2.so"} | |
ead49a57 | 684 | {"Shared library with TLS and hidden symbols (3)" |
897aea50 | 685 | "-shared -melf32btsmip -T tls-hidden3.ld" "" |
ead49a57 RS |
686 | "-EB -march=mips2 -32 -KPIC" {tls-hidden3a.s tls-hidden3b.s} |
687 | {{objdump -dj.text tls-hidden3.d} {objdump -sj.got tls-hidden3.got} | |
688 | {readelf --relocs tls-hidden3.r}} | |
689 | "tls-hidden3.so"} | |
690 | {"Shared library with TLS and hidden symbols (4)" | |
897aea50 | 691 | "-shared -melf32btsmip -T tls-hidden3.ld" "" |
ead49a57 RS |
692 | "-EB -march=mips2 -32 -KPIC" {tls-hidden4a.s tls-hidden4b.s} |
693 | {{objdump -sj.got tls-hidden4.got} {readelf --relocs tls-hidden4.r}} | |
694 | "tls-hidden4.so"} | |
f4e584bd DJ |
695 | } |
696 | ||
697 | if {[istarget mips*-*-linux*]} { | |
698 | run_ld_link_tests $mips_tls_tests | |
699 | } | |
700 | ||
08e8dfaf RS |
701 | set mips16_call_global_test [list \ |
702 | [list "Global calls from mips16" \ | |
897aea50 | 703 | "$abi_ldflags(o32) -T no-shared-1.ld" "" \ |
ef2b5578 | 704 | "$abi_asflags(o32) -mips32r2" \ |
08e8dfaf RS |
705 | {mips16-call-global-1.s mips16-call-global-2.s mips16-call-global-3.s} \ |
706 | {{objdump -dr mips16-call-global.d}} \ | |
707 | "mips16-call-global"]] | |
35d3d567 TS |
708 | |
709 | run_ld_link_tests $mips16_call_global_test | |
b9d58d71 | 710 | |
08e8dfaf RS |
711 | set mips16_intermix_test [list \ |
712 | [list "Intermixing mips32 and mips16 functions" \ | |
897aea50 | 713 | "$abi_ldflags(o32)" "" \ |
ef2b5578 | 714 | "$abi_asflags(o32) -mips32r2" \ |
08e8dfaf RS |
715 | {mips16-intermix-1.s mips16-intermix-2.s} \ |
716 | {{objdump -t mips16-intermix.d}} \ | |
717 | "mips16-intermix"]] | |
b9d58d71 TS |
718 | |
719 | run_ld_link_tests $mips16_intermix_test | |
b314ec0e RS |
720 | |
721 | run_dump_test "mips16-local-stubs-1" | |
2cf19d5c | 722 | |
ca9584fb CM |
723 | set mips16_fp_stub_test [list \ |
724 | [list "Floating-point stub for mips16 functions" \ | |
725 | "$abi_ldflags(o32)" "" \ | |
726 | "$abi_asflags(o32) -mips32r2" \ | |
727 | {mips16-fp-stub-1.s mips16-fp-stub-2.s} \ | |
728 | {{readelf --debug-dump=frames mips16-fp-stub.d}} \ | |
729 | "mips16-fp-stub"]] | |
730 | ||
731 | run_ld_link_tests $mips16_fp_stub_test | |
732 | ||
e319abb4 MF |
733 | set o32flagslist [list [list as $abi_asflags(o32)] [list ld $abi_ldflags(o32)]] |
734 | ||
351cdf24 | 735 | foreach firstfpabi [list 0 1 2 3 4 5 6 7 ] { |
e319abb4 MF |
736 | foreach secondfpabi [list 4 5 6 7 ] { |
737 | run_dump_test "attr-gnu-4-${firstfpabi}${secondfpabi}" $o32flagslist | |
738 | } | |
739 | } | |
740 | foreach firstfpabi [list 4 5 6 7 ] { | |
3350cc01 | 741 | foreach secondfpabi [list 0 1 2 3 8 9] { |
e319abb4 MF |
742 | run_dump_test "attr-gnu-4-${firstfpabi}${secondfpabi}" $o32flagslist |
743 | } | |
744 | } | |
745 | foreach firstfpabi [list 0 1 2 3 ] { | |
3350cc01 | 746 | foreach secondfpabi [list 0 1 2 3 8 9] { |
351cdf24 MF |
747 | run_dump_test "attr-gnu-4-${firstfpabi}${secondfpabi}" |
748 | } | |
749 | } | |
e319abb4 | 750 | |
351cdf24 MF |
751 | run_dump_test "attr-gnu-4-81" |
752 | ||
753 | run_dump_test "attr-gnu-8-00" | |
754 | run_dump_test "attr-gnu-8-01" | |
755 | run_dump_test "attr-gnu-8-02" | |
756 | run_dump_test "attr-gnu-8-10" | |
757 | run_dump_test "attr-gnu-8-11" | |
758 | run_dump_test "attr-gnu-8-12" | |
759 | run_dump_test "attr-gnu-8-20" | |
760 | run_dump_test "attr-gnu-8-21" | |
761 | run_dump_test "attr-gnu-8-22" | |
762 | ||
e319abb4 MF |
763 | run_dump_test "attr-gnu-4-0-ph" $o32flagslist |
764 | run_dump_test "attr-gnu-4-1-ph" $o32flagslist | |
765 | run_dump_test "attr-gnu-4-2-ph" $o32flagslist | |
766 | run_dump_test "attr-gnu-4-3-ph" $o32flagslist | |
767 | run_dump_test "attr-gnu-4-4-ph" $o32flagslist | |
768 | run_dump_test "attr-gnu-4-5-ph" $o32flagslist | |
769 | run_dump_test "attr-gnu-4-6-ph" $o32flagslist | |
770 | run_dump_test "attr-gnu-4-7-ph" $o32flagslist | |
771 | ||
772 | if $has_newabi { | |
773 | run_dump_test "attr-gnu-4-0-n32-ph" | |
774 | run_dump_test "attr-gnu-4-1-n32-ph" | |
775 | run_dump_test "attr-gnu-4-2-n32-ph" | |
776 | run_dump_test "attr-gnu-4-3-n32-ph" | |
777 | run_dump_test "attr-gnu-4-0-n64-ph" | |
778 | run_dump_test "attr-gnu-4-1-n64-ph" | |
779 | run_dump_test "attr-gnu-4-2-n64-ph" | |
780 | run_dump_test "attr-gnu-4-3-n64-ph" | |
781 | } | |
782 | ||
783 | run_dump_test "abiflags-strip1-ph" $o32flagslist | |
784 | run_dump_test "abiflags-strip2-ph" $o32flagslist | |
785 | run_dump_test "abiflags-strip3-ph" $o32flagslist | |
786 | run_dump_test "abiflags-strip4-ph" $o32flagslist | |
787 | run_dump_test "abiflags-strip5-ph" $o32flagslist | |
788 | run_dump_test "abiflags-strip6-ph" $o32flagslist | |
789 | run_dump_test "abiflags-strip7-ph" $o32flagslist | |
790 | run_dump_test "abiflags-strip8-ph" $o32flagslist | |
791 | run_dump_test "abiflags-strip9-ph" $o32flagslist | |
09c14161 | 792 | run_dump_test "abiflags-strip10-ph" $o32flagslist |
634835ae | 793 | |
ba92f887 MR |
794 | run_dump_test "nan-legacy" |
795 | run_dump_test "nan-2008" | |
796 | run_dump_test "nan-mixed-1" | |
797 | run_dump_test "nan-mixed-2" | |
798 | ||
634835ae RS |
799 | if { $linux_gnu } { |
800 | run_ld_link_tests { | |
801 | {"GOT and versioning 1" | |
897aea50 | 802 | "-shared -melf32btsmip --version-script got-vers-1.ver" "" |
634835ae RS |
803 | "-EB -mips2 -32" {got-vers-1a.s got-vers-1b.s} |
804 | {{readelf -d got-vers-1.dd} | |
805 | {readelf --symbols got-vers-1.sd} | |
806 | {readelf --relocs got-vers-1.rd}} | |
807 | "got-vers-1.so"} | |
808 | } | |
809 | } | |
e7e2196d MR |
810 | |
811 | run_dump_test "undefined" | |
1063d8cf CF |
812 | |
813 | # Test the conversion from jr to b | |
814 | if { $linux_gnu } { | |
815 | run_dump_test "jr-to-b-1" | |
816 | run_dump_test "jr-to-b-2" | |
817 | } | |
df58fc94 RS |
818 | |
819 | # MIPS16 and microMIPS interlinking test. | |
820 | run_dump_test "mips16-and-micromips" | |
9b11fa1a MR |
821 | |
822 | # Export class call relocation tests. | |
823 | set abis [concat o32 [expr {$has_newabi ? "n32 n64" : ""}]] | |
824 | foreach { abi } $abis { | |
825 | set loadaddr [string map \ | |
826 | {o32 0x12340000 n32 0x12340000 n64 0x123456789abc0000} $abi] | |
827 | set suff [subst \ | |
828 | [expr { [istarget *-*-irix*] \ | |
829 | ? [string map {o32 o32-irix n32 n32 n64 n64} $abi] \ | |
830 | : $abi }]] | |
831 | run_ld_link_tests [list \ | |
832 | [list \ | |
833 | "MIPS export class call relocation test ($abi)" \ | |
897aea50 | 834 | "$abi_ldflags($abi) -shared -Ttext $loadaddr -T export-class-call16.ld" "" \ |
9b11fa1a MR |
835 | "$abi_asflags($abi) -mips3 -KPIC" \ |
836 | [list export-class-call16-${abi}.s export-class-call16-def.s] \ | |
837 | [list \ | |
838 | "objdump -d export-class-call16-${suff}.dd" \ | |
839 | "readelf -A export-class-call16-${abi}.gd"] \ | |
840 | "export-class-call16-${abi}.so"]] | |
841 | } | |
cde7cb01 MR |
842 | |
843 | # Magic __ehdr_start symbol tests. | |
844 | set abis [concat o32 [expr {$has_newabi ? "n32 n64" : ""}]] | |
845 | foreach { abi } $abis { | |
846 | set suff [string map {o32 o32 n32 new n64 new} $abi] | |
847 | run_ld_link_tests [list \ | |
848 | [list \ | |
849 | "MIPS magic __ehdr_start symbol test 1 ($abi)" \ | |
850 | "$abi_ldflags($abi) -T ehdr_start-1.ld" "" \ | |
851 | "$abi_asflags($abi)" \ | |
852 | [list ehdr_start-${suff}.s] \ | |
853 | [list "readelf -s ehdr_start-1.nd"] \ | |
854 | "ehdr_start-1-${abi}"]] | |
855 | if [regexp "(?:n32|n64)" "$abi"] { | |
856 | setup_kfail "mips*-*-*" "ld/15428" | |
857 | } | |
858 | run_ld_link_tests [list \ | |
859 | [list \ | |
860 | "MIPS magic __ehdr_start symbol test 2 ($abi)" \ | |
861 | "$abi_ldflags($abi) -T ehdr_start-2.ld" "" \ | |
862 | "$abi_asflags($abi)" \ | |
863 | [list ehdr_start-${suff}.s] \ | |
864 | [list "readelf -s ehdr_start-2.nd"] \ | |
865 | "ehdr_start-2-${abi}"]] | |
866 | } | |
d6101ac2 MR |
867 | |
868 | # R_MIPS_JALR reloc tests. | |
869 | set abis [concat o32 [expr {$has_newabi ? "n32 n64" : ""}]] | |
870 | foreach { abi } $abis { | |
871 | run_ld_link_tests [list \ | |
872 | [list \ | |
873 | "MIPS JALR reloc test ($abi)" \ | |
874 | "$abi_ldflags($abi) -T jalr3.ld" "" \ | |
875 | "$abi_asflags($abi)" \ | |
876 | [list ../../../gas/testsuite/gas/mips/jalr3.s] \ | |
877 | [list "objdump -d jalr3.dd"] \ | |
878 | "jalr3-${abi}"]] | |
879 | } | |
690f47bf RS |
880 | |
881 | proc build_mips_plt_lib { abi } { | |
882 | global abi_asflags | |
883 | global abi_ldflags | |
884 | ||
885 | run_ld_link_tests [list \ | |
886 | [list "Shared $abi library for compressed PLT tests" \ | |
887 | "-shared $abi_ldflags($abi)" "" \ | |
888 | "$abi_asflags($abi)" \ | |
889 | { compressed-plt-1-dyn.s } \ | |
890 | {} \ | |
891 | "compressed-plt-1-${abi}-dyn.so"]] | |
892 | } | |
893 | ||
894 | proc run_mips_plt_test { name abi filter micromips suffix {extra {}} } { | |
895 | global abi_asflags | |
896 | global abi_ldflags | |
897 | ||
898 | set as_flags "$abi_asflags($abi) --defsym filter=$filter" | |
899 | append as_flags " --defsym micromips=$micromips --defsym $abi=1" | |
900 | if {[string equal $abi o32]} { | |
901 | append as_flags " -march=mips2" | |
902 | } | |
903 | set ld_flags "$abi_ldflags($abi) -T compressed-plt-1.ld" | |
904 | set dynobj "tmpdir/compressed-plt-1-${abi}-dyn.so" | |
905 | set files [list] | |
906 | if { $filter & 3 } { | |
907 | lappend files compressed-plt-1a.s | |
908 | } | |
909 | if { $filter & 12 } { | |
910 | lappend files compressed-plt-1b.s | |
911 | } | |
912 | if { $filter & 16 } { | |
913 | lappend files compressed-plt-1c.s | |
914 | } | |
915 | eval [list lappend files] $extra | |
916 | set readelf_flags "-A --syms --relocs -d" | |
917 | if { [string match "*word*" $suffix] } { | |
918 | append readelf_flags " -x.data" | |
919 | } | |
920 | set objdump_flags "-d -Mgpr-names=numeric" | |
921 | set basename "compressed-plt-1-${abi}-${suffix}" | |
922 | run_ld_link_tests [list \ | |
923 | [list "$name" $ld_flags $dynobj \ | |
924 | "$as_flags" $files \ | |
925 | [list [list readelf $readelf_flags ${basename}.rd] \ | |
926 | [list objdump $objdump_flags ${basename}.od]] \ | |
927 | $basename]] | |
928 | } | |
929 | ||
930 | if { $linux_gnu } { | |
931 | build_mips_plt_lib o32 | |
932 | run_mips_plt_test "o32 PLTs for standard encoding" o32 28 0 se | |
933 | run_mips_plt_test "o32 PLTs for MIPS16 encoding" o32 19 0 mips16-only | |
934 | run_mips_plt_test "o32 PLTs for microMIPS encoding" o32 19 1 umips-only | |
935 | run_mips_plt_test "o32 PLTs for mixed MIPS and MIPS16" \ | |
936 | o32 -1 0 mips16 | |
937 | run_mips_plt_test "o32 PLTs for mixed MIPS and MIPS16 with %got" \ | |
938 | o32 -1 0 mips16-got compressed-plt-1d.s | |
939 | run_mips_plt_test "o32 PLTs for mixed MIPS and MIPS16 with .word" \ | |
940 | o32 -1 0 mips16-word compressed-plt-1e.s | |
941 | run_mips_plt_test "o32 PLTs for mixed MIPS and microMIPS" \ | |
942 | o32 -1 1 umips | |
943 | run_mips_plt_test "o32 PLTs for mixed MIPS and microMIPS with %got" \ | |
944 | o32 -1 1 umips-got compressed-plt-1d.s | |
945 | run_mips_plt_test "o32 PLTs for mixed MIPS and microMIPS with .word" \ | |
946 | o32 -1 1 umips-word compressed-plt-1e.s | |
947 | ||
948 | if $has_newabi { | |
949 | build_mips_plt_lib n32 | |
950 | run_mips_plt_test "n32 PLTs for mixed MIPS and MIPS16" \ | |
951 | n32 -1 0 mips16 | |
952 | run_mips_plt_test "n32 PLTs for mixed MIPS and microMIPS" \ | |
953 | n32 -1 1 umips | |
954 | } | |
955 | } | |
1f599d0e MR |
956 | |
957 | # PR ld/19908 export class tests. | |
958 | if { $linux_gnu } { | |
959 | run_ld_link_tests [list \ | |
960 | [list "Shared library for MIPS export class symbol reference tests" \ | |
961 | "$abi_ldflags(o32) -shared" "" \ | |
962 | "$abi_asflags(o32)" \ | |
963 | { export-class-ref-f2.s } \ | |
964 | { { readelf --dyn-syms export-class-ref-lib.sd } } \ | |
965 | "export-class-ref-lib.so"]] | |
966 | foreach { class flag } { internal 1 hidden 2 protected 3 } { | |
967 | run_ld_link_tests [list \ | |
968 | [list "MIPS $class symbol reference test 1" \ | |
969 | "$abi_ldflags(o32) -e f0" "tmpdir/export-class-ref-lib.so" \ | |
970 | "$abi_asflags(o32) --defsym defv=$flag" \ | |
971 | { export-class-ref-f0.s export-class-ref-f1.s } \ | |
972 | [list [list readelf --dyn-syms export-$class-ref.sd] \ | |
973 | [list readelf --dyn-syms export-local-ref.sd]] \ | |
974 | "export-$class-ref"] \ | |
975 | [list "MIPS $class symbol reference test 2" \ | |
976 | "$abi_ldflags(o32) -e f0" "tmpdir/export-class-ref-lib.so" \ | |
977 | "$abi_asflags(o32) --defsym defv=$flag --defsym refv=$flag" \ | |
978 | { export-class-ref-f0.s export-class-ref-f1.s } \ | |
979 | [list [list readelf --dyn-syms export-$class-ref.sd] \ | |
980 | [list readelf --dyn-syms export-local-ref.sd]] \ | |
981 | "export-$class-ref"]] | |
982 | } | |
983 | } |