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