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