1 |
38 |
julius |
# Expect script for MIPS ELF linker tests
|
2 |
|
|
# Copyright 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
|
3 |
|
|
#
|
4 |
|
|
# This file is part of the GNU Binutils.
|
5 |
|
|
#
|
6 |
|
|
# This program is free software; you can redistribute it and/or modify
|
7 |
|
|
# it under the terms of the GNU General Public License as published by
|
8 |
|
|
# the Free Software Foundation; either version 3 of the License, or
|
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
|
18 |
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
19 |
|
|
# MA 02110-1301, USA.
|
20 |
|
|
#
|
21 |
|
|
|
22 |
|
|
if {[istarget "mips*-*-vxworks"]} {
|
23 |
|
|
set mipsvxtests {
|
24 |
|
|
{"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
|
25 |
|
|
"-mips2" {vxworks1-lib.s}
|
26 |
|
|
{{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
|
27 |
|
|
{readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
|
28 |
|
|
"libvxworks1.so"}
|
29 |
|
|
{"VxWorks executable test 1 (dynamic)" \
|
30 |
|
|
"tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
|
31 |
|
|
"-mips2" {vxworks1.s}
|
32 |
|
|
{{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
|
33 |
|
|
"vxworks1"}
|
34 |
|
|
{"VxWorks executable test 2 (dynamic)" \
|
35 |
|
|
"-Tvxworks1.ld -q --force-dynamic"
|
36 |
|
|
"-mips2" {vxworks2.s}
|
37 |
|
|
{{readelf --segments vxworks2.sd}}
|
38 |
|
|
"vxworks2"}
|
39 |
|
|
{"VxWorks executable test 2 (static)"
|
40 |
|
|
"-Tvxworks1.ld"
|
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"
|
47 |
|
|
run_dump_test "vxworks-forced-local-1"
|
48 |
|
|
return
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
if {![istarget mips*-*-*] || ![is_elf_format]} {
|
52 |
|
|
return
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]]
|
56 |
|
|
set linux_gnu [expr [istarget mips*-*-linux*]]
|
57 |
|
|
set embedded_elf [expr [istarget mips*-*-elf]]
|
58 |
|
|
|
59 |
|
|
if { [istarget mips64*-linux-gnu] } {
|
60 |
|
|
set o32_as_flags "-32 -EB"
|
61 |
|
|
set o32_ld_flags "-melf32btsmip"
|
62 |
|
|
} else {
|
63 |
|
|
set o32_as_flags ""
|
64 |
|
|
set o32_ld_flags ""
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
# Check MIPS16 markings being passed through link.
|
68 |
|
|
run_dump_test "mips16-1"
|
69 |
|
|
|
70 |
|
|
# MIPS branch offset final link checking.
|
71 |
|
|
run_dump_test "branch-misc-1"
|
72 |
|
|
|
73 |
|
|
# Test multi-got link. We only do this on GNU/Linux because it requires
|
74 |
|
|
# the "traditional" emulations.
|
75 |
|
|
if { $linux_gnu } {
|
76 |
|
|
run_dump_test "multi-got-1"
|
77 |
|
|
run_dump_test "multi-got-no-shared"
|
78 |
|
|
run_dump_test "multi-got-hidden-1"
|
79 |
|
|
run_dump_test "multi-got-hidden-2"
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
if $has_newabi {
|
83 |
|
|
run_dump_test "elf-rel-got-n32"
|
84 |
|
|
run_dump_test "elf-rel-xgot-n32"
|
85 |
|
|
if { $linux_gnu } {
|
86 |
|
|
run_dump_test "elf-rel-got-n64-linux"
|
87 |
|
|
run_dump_test "elf-rel-xgot-n64-linux"
|
88 |
|
|
} else {
|
89 |
|
|
run_dump_test "elf-rel-got-n64"
|
90 |
|
|
run_dump_test "elf-rel-xgot-n64"
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
run_dump_test "relax-jalr-n32"
|
94 |
|
|
run_dump_test "relax-jalr-n32-shared"
|
95 |
|
|
run_dump_test "relax-jalr-n64"
|
96 |
|
|
run_dump_test "relax-jalr-n64-shared"
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
if { $linux_gnu } {
|
100 |
|
|
run_dump_test "rel32-o32"
|
101 |
|
|
run_dump_test "rel32-n32"
|
102 |
|
|
run_dump_test "rel64"
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
if { $embedded_elf } {
|
106 |
|
|
run_dump_test "region1"
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
if $embedded_elf {
|
110 |
|
|
# This could work on other targets too, but would need the appropriate
|
111 |
|
|
# ld -m switch.
|
112 |
|
|
run_dump_test "reloc-1-rel"
|
113 |
|
|
}
|
114 |
|
|
if $has_newabi {
|
115 |
|
|
run_dump_test "reloc-1-n32"
|
116 |
|
|
if $linux_gnu {
|
117 |
|
|
# Uses a linux-specific ld -m switch
|
118 |
|
|
run_dump_test "reloc-1-n64"
|
119 |
|
|
}
|
120 |
|
|
}
|
121 |
|
|
run_dump_test "reloc-2"
|
122 |
|
|
run_dump_test "reloc-merge-lo16"
|
123 |
|
|
run_dump_test "reloc-3"
|
124 |
|
|
if {$has_newabi} {
|
125 |
|
|
run_dump_test "reloc-3-n32"
|
126 |
|
|
}
|
127 |
|
|
run_dump_test "reloc-4"
|
128 |
|
|
run_dump_test "reloc-5"
|
129 |
|
|
|
130 |
|
|
if {$has_newabi && $linux_gnu} {
|
131 |
|
|
run_dump_test "eh-frame1-n32"
|
132 |
|
|
run_dump_test "eh-frame1-n64"
|
133 |
|
|
run_dump_test "eh-frame2-n32"
|
134 |
|
|
run_dump_test "eh-frame2-n64"
|
135 |
|
|
}
|
136 |
|
|
if {$embedded_elf} {
|
137 |
|
|
run_dump_test "eh-frame3"
|
138 |
|
|
run_dump_test "eh-frame4"
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
run_dump_test "jaloverflow"
|
142 |
|
|
run_dump_test "jaloverflow-2"
|
143 |
|
|
if {$has_newabi} {
|
144 |
|
|
run_dump_test "jalbal"
|
145 |
|
|
}
|
146 |
|
|
|
147 |
|
|
run_dump_test "mips16-hilo"
|
148 |
|
|
if {$has_newabi} {
|
149 |
|
|
run_dump_test "mips16-hilo-n32"
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
if { $linux_gnu } {
|
153 |
|
|
run_dump_test "textrel-1"
|
154 |
|
|
run_dump_test "got-page-1"
|
155 |
|
|
if $has_newabi {
|
156 |
|
|
run_dump_test "got-page-2"
|
157 |
|
|
run_dump_test "dyn-sec64"
|
158 |
|
|
}
|
159 |
|
|
run_dump_test "got-page-3"
|
160 |
|
|
run_dump_test "got-dump-1"
|
161 |
|
|
if $has_newabi {
|
162 |
|
|
run_dump_test "got-dump-2"
|
163 |
|
|
}
|
164 |
|
|
}
|
165 |
|
|
|
166 |
|
|
if $has_newabi {
|
167 |
|
|
run_dump_test "emit-relocs-1"
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
run_dump_test "hash1a"
|
171 |
|
|
run_dump_test "hash1b"
|
172 |
|
|
run_dump_test "hash1c"
|
173 |
|
|
|
174 |
|
|
if {[istarget mips*-*-linux*]} {
|
175 |
|
|
# The number of symbols that are always included in the symbol table
|
176 |
|
|
# for these tests. The 4 are:
|
177 |
|
|
#
|
178 |
|
|
# the null symbol entry
|
179 |
|
|
# the .MIPS.stubs section symbol
|
180 |
|
|
# _gp
|
181 |
|
|
# _GLOBAL_OFFSET_TABLE_
|
182 |
|
|
set base_syms 4
|
183 |
|
|
foreach dynsym { 7fff 8000 fff0 10000 2fe80 } {
|
184 |
|
|
run_ld_link_tests \
|
185 |
|
|
[list [list \
|
186 |
|
|
"Stub for dynsym 0x$dynsym" \
|
187 |
|
|
"-shared -melf32btsmip -T stub-dynsym-1.ld" \
|
188 |
|
|
[concat \
|
189 |
|
|
"-EB -march=mips1 -32 -KPIC" \
|
190 |
|
|
"--defsym base_syms=$base_syms" \
|
191 |
|
|
"--defsym dynsym=0x$dynsym"] \
|
192 |
|
|
[list "stub-dynsym-1.s"] \
|
193 |
|
|
[list [list \
|
194 |
|
|
"objdump" "-dz" \
|
195 |
|
|
"stub-dynsym-1-$dynsym.d"]] \
|
196 |
|
|
"stub-dynsym-1-$dynsym"]]
|
197 |
|
|
}
|
198 |
|
|
}
|
199 |
|
|
|
200 |
|
|
# For tests which may involve multiple files, use run_ld_link_tests.
|
201 |
|
|
|
202 |
|
|
# List contains test-items with 3 items followed by 2 lists:
|
203 |
|
|
# 0:name 1:ld options 2:assembler options
|
204 |
|
|
# 3:filenames of assembler files 4: action and options. 5: name of output file
|
205 |
|
|
|
206 |
|
|
# Actions:
|
207 |
|
|
# objdump: Apply objdump options on result. Compare with regex (last arg).
|
208 |
|
|
# nm: Apply nm options on result. Compare with regex (last arg).
|
209 |
|
|
# readelf: Apply readelf options on result. Compare with regex (last arg).
|
210 |
|
|
|
211 |
|
|
set mips_tls_tests {
|
212 |
|
|
{"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld"
|
213 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s}
|
214 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsbin-o32.d} {objdump -srj.got tlsbin-o32.got}}
|
215 |
|
|
"tls-static-o32"}
|
216 |
|
|
{"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld"
|
217 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
218 |
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32.got}}
|
219 |
|
|
"tlslib-o32.so"}
|
220 |
|
|
{"Dynamic executable with TLS"
|
221 |
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so"
|
222 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s}
|
223 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32.d} {objdump -Rsj.got tlsdyn-o32.got}}
|
224 |
|
|
"tls-dynamic-o32"}
|
225 |
|
|
{"Shared library with multiple GOTs and TLS"
|
226 |
|
|
"-shared -melf32btsmip -T mips-lib.ld"
|
227 |
|
|
"-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s}
|
228 |
|
|
{{readelf {-d -r} tls-multi-got-1.r}
|
229 |
|
|
{objdump {-dr -m mips:isa32r2} tls-multi-got-1.d}
|
230 |
|
|
{objdump -Rsj.got tls-multi-got-1.got}}
|
231 |
|
|
"tlslib-multi.so"}
|
232 |
|
|
{"Shared library with TLS and versioning"
|
233 |
|
|
"-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver"
|
234 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
235 |
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-ver.got}}
|
236 |
|
|
"tlslib-o32-ver.so"}
|
237 |
|
|
{"Dynamic executable with TLS and versioning"
|
238 |
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so"
|
239 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s}
|
240 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-1.d} {objdump -Rsj.got tlsdyn-o32-1.got}}
|
241 |
|
|
"tls-dynamic-o32-ver"}
|
242 |
|
|
{"Dynamic executable with TLS and versioning (order 2)"
|
243 |
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o"
|
244 |
|
|
"-EB -march=mips1 -32 -KPIC" {}
|
245 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-2.d} {objdump -Rsj.got tlsdyn-o32-2.got}}
|
246 |
|
|
"tls-dynamic-o32-ver-2"}
|
247 |
|
|
{"Dynamic executable with TLS and versioning (order 3)"
|
248 |
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o"
|
249 |
|
|
"-EB -march=mips1 -32 -KPIC" {}
|
250 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-3.d} {objdump -Rsj.got tlsdyn-o32-3.got}}
|
251 |
|
|
"tls-dynamic-o32-ver-3"}
|
252 |
|
|
{"Shared library with TLS and hidden symbols"
|
253 |
|
|
"-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver"
|
254 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
255 |
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}}
|
256 |
|
|
"tlslib-o32-hidden.so"}
|
257 |
|
|
{"Shared library with TLS and hidden symbols (2)"
|
258 |
|
|
"-shared -melf32btsmip -T mips-lib.ld"
|
259 |
|
|
"-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s}
|
260 |
|
|
{{objdump -drj.text tls-hidden2.d} {objdump -sj.got tls-hidden2-got.d}}
|
261 |
|
|
"tls-hidden2.so"}
|
262 |
|
|
{"Shared library with TLS and hidden symbols (3)"
|
263 |
|
|
"-shared -melf32btsmip -T tls-hidden3.ld"
|
264 |
|
|
"-EB -march=mips2 -32 -KPIC" {tls-hidden3a.s tls-hidden3b.s}
|
265 |
|
|
{{objdump -dj.text tls-hidden3.d} {objdump -sj.got tls-hidden3.got}
|
266 |
|
|
{readelf --relocs tls-hidden3.r}}
|
267 |
|
|
"tls-hidden3.so"}
|
268 |
|
|
{"Shared library with TLS and hidden symbols (4)"
|
269 |
|
|
"-shared -melf32btsmip -T tls-hidden3.ld"
|
270 |
|
|
"-EB -march=mips2 -32 -KPIC" {tls-hidden4a.s tls-hidden4b.s}
|
271 |
|
|
{{objdump -sj.got tls-hidden4.got} {readelf --relocs tls-hidden4.r}}
|
272 |
|
|
"tls-hidden4.so"}
|
273 |
|
|
}
|
274 |
|
|
|
275 |
|
|
if {[istarget mips*-*-linux*]} {
|
276 |
|
|
run_ld_link_tests $mips_tls_tests
|
277 |
|
|
}
|
278 |
|
|
|
279 |
|
|
set mips16_call_global_test [list \
|
280 |
|
|
[list "Global calls from mips16" \
|
281 |
|
|
"$o32_ld_flags" \
|
282 |
|
|
"$o32_as_flags -mips32r2" \
|
283 |
|
|
{mips16-call-global-1.s mips16-call-global-2.s mips16-call-global-3.s} \
|
284 |
|
|
{{objdump -dr mips16-call-global.d}} \
|
285 |
|
|
"mips16-call-global"]]
|
286 |
|
|
|
287 |
|
|
run_ld_link_tests $mips16_call_global_test
|
288 |
|
|
|
289 |
|
|
set mips16_intermix_test [list \
|
290 |
|
|
[list "Intermixing mips32 and mips16 functions" \
|
291 |
|
|
"$o32_ld_flags" \
|
292 |
|
|
"$o32_as_flags -mips32r2" \
|
293 |
|
|
{mips16-intermix-1.s mips16-intermix-2.s} \
|
294 |
|
|
{{objdump -t mips16-intermix.d}} \
|
295 |
|
|
"mips16-intermix"]]
|
296 |
|
|
|
297 |
|
|
run_ld_link_tests $mips16_intermix_test
|
298 |
|
|
|
299 |
|
|
run_dump_test "mips16-local-stubs-1"
|
300 |
|
|
|
301 |
|
|
run_dump_test "attr-gnu-4-00"
|
302 |
|
|
run_dump_test "attr-gnu-4-01"
|
303 |
|
|
run_dump_test "attr-gnu-4-02"
|
304 |
|
|
run_dump_test "attr-gnu-4-03"
|
305 |
|
|
run_dump_test "attr-gnu-4-04"
|
306 |
|
|
run_dump_test "attr-gnu-4-05"
|
307 |
|
|
run_dump_test "attr-gnu-4-10"
|
308 |
|
|
run_dump_test "attr-gnu-4-11"
|
309 |
|
|
run_dump_test "attr-gnu-4-12"
|
310 |
|
|
run_dump_test "attr-gnu-4-13"
|
311 |
|
|
run_dump_test "attr-gnu-4-14"
|
312 |
|
|
run_dump_test "attr-gnu-4-15"
|
313 |
|
|
run_dump_test "attr-gnu-4-20"
|
314 |
|
|
run_dump_test "attr-gnu-4-21"
|
315 |
|
|
run_dump_test "attr-gnu-4-22"
|
316 |
|
|
run_dump_test "attr-gnu-4-23"
|
317 |
|
|
run_dump_test "attr-gnu-4-24"
|
318 |
|
|
run_dump_test "attr-gnu-4-25"
|
319 |
|
|
run_dump_test "attr-gnu-4-30"
|
320 |
|
|
run_dump_test "attr-gnu-4-31"
|
321 |
|
|
run_dump_test "attr-gnu-4-32"
|
322 |
|
|
run_dump_test "attr-gnu-4-33"
|
323 |
|
|
run_dump_test "attr-gnu-4-34"
|
324 |
|
|
run_dump_test "attr-gnu-4-35"
|
325 |
|
|
run_dump_test "attr-gnu-4-40"
|
326 |
|
|
run_dump_test "attr-gnu-4-41"
|
327 |
|
|
run_dump_test "attr-gnu-4-42"
|
328 |
|
|
run_dump_test "attr-gnu-4-43"
|
329 |
|
|
run_dump_test "attr-gnu-4-44"
|
330 |
|
|
run_dump_test "attr-gnu-4-45"
|
331 |
|
|
run_dump_test "attr-gnu-4-51"
|