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