1 # Expect script
for MIPS ELF linker tests
2 # Copyright
2002, 2003, 2004, 2005, 2007 Free Software Foundation
, Inc.
4 # This file is part of the GNU Binutils.
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.
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.
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
,
22 if {[istarget
"mips*-*-vxworks"]} {
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
}}
29 {"VxWorks executable test 1 (dynamic)" \
30 "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
32 {{readelf
--relocs vxworks1.rd
} {objdump
-dr vxworks1.dd
}}
34 {"VxWorks executable test 2 (dynamic)" \
35 "-Tvxworks1.ld -q --force-dynamic"
37 {{readelf
--segments vxworks2.sd
}}
39 {"VxWorks executable test 2 (static)"
42 {{readelf
--segments vxworks2
-static.sd
}}
45 run_ld_link_tests $mipsvxtests
46 run_dump_test
"vxworks1-static"
47 run_dump_test
"vxworks-forced-local-1"
51 if {![istarget mips
*-*-*] ||
![is_elf_format
]} {
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
]]
60 # Check MIPS16 markings being passed through link.
61 run_dump_test
"mips16-1"
63 # MIPS branch offset final link checking.
64 run_dump_test
"branch-misc-1"
66 # Test multi
-got link. We only
do this
on GNU
/Linux because it requires
67 # the
"traditional" emulations.
69 run_dump_test
"multi-got-1"
70 run_dump_test
"multi-got-no-shared"
71 run_dump_test
"multi-got-hidden-1"
72 run_dump_test
"multi-got-hidden-2"
76 run_dump_test
"elf-rel-got-n32"
77 run_dump_test
"elf-rel-xgot-n32"
79 run_dump_test
"elf-rel-got-n64-linux"
80 run_dump_test
"elf-rel-xgot-n64-linux"
82 run_dump_test
"elf-rel-got-n64"
83 run_dump_test
"elf-rel-xgot-n64"
86 run_dump_test
"relax-jalr-n32"
87 run_dump_test
"relax-jalr-n32-shared"
88 run_dump_test
"relax-jalr-n64"
89 run_dump_test
"relax-jalr-n64-shared"
93 run_dump_test
"rel32-o32"
94 run_dump_test
"rel32-n32"
98 if { $embedded_elf
} {
99 run_dump_test
"region1"
103 # This could work
on other targets too
, but would need the appropriate
105 run_dump_test
"reloc-1-rel"
108 run_dump_test
"reloc-1-n32"
110 # Uses a linux
-specific
ld -m
switch
111 run_dump_test
"reloc-1-n64"
114 run_dump_test
"reloc-2"
115 run_dump_test
"reloc-merge-lo16"
116 run_dump_test
"reloc-3"
118 run_dump_test
"reloc-3-n32"
120 run_dump_test
"reloc-4"
121 run_dump_test
"reloc-5"
123 if {$has_newabi
&& $linux_gnu
} {
124 run_dump_test
"eh-frame1-n32"
125 run_dump_test
"eh-frame1-n64"
126 run_dump_test
"eh-frame2-n32"
127 run_dump_test
"eh-frame2-n64"
130 run_dump_test
"eh-frame3"
131 run_dump_test
"eh-frame4"
134 run_dump_test
"jaloverflow"
135 run_dump_test
"jaloverflow-2"
137 run_dump_test
"jalbal"
140 run_dump_test
"mips16-hilo"
142 run_dump_test
"mips16-hilo-n32"
146 run_dump_test
"textrel-1"
147 run_dump_test
"got-page-1"
149 run_dump_test
"got-page-2"
151 run_dump_test
"got-page-3"
155 run_dump_test
"emit-relocs-1"
158 run_dump_test
"hash1a"
159 run_dump_test
"hash1b"
160 run_dump_test
"hash1c"
162 if {[istarget mips
*-*-linux
*]} {
163 # The number of symbols that are always included in the symbol table
164 #
for these tests. The
4 are
:
166 # the null symbol entry
167 # the .MIPS.stubs section symbol
169 # _GLOBAL_OFFSET_TABLE_
171 foreach dynsym
{ 7fff
8000 fff0
10000 2fe80
} {
174 "Stub for dynsym 0x$dynsym" \
175 "-shared -melf32btsmip -T stub-dynsym-1.ld" \
177 "-EB -march=mips1 -32 -KPIC" \
178 "--defsym base_syms=$base_syms" \
179 "--defsym dynsym=0x$dynsym"] \
180 [list
"stub-dynsym-1.s"] \
183 "stub-dynsym-1-$dynsym.d"]] \
184 "stub-dynsym-1-$dynsym"]]
188 #
For tests which may involve multiple files
, use run_ld_link_tests.
190 # List contains test
-items with
3 items followed by
2 lists
:
191 #
0:name 1:ld options
2:assembler options
192 #
3:filenames of assembler files
4: action and options.
5: name of output file
195 # objdump
: Apply objdump options
on result. Compare with regex
(last
arg).
196 # nm
: Apply nm options
on result. Compare with regex
(last
arg).
197 # readelf
: Apply readelf options
on result. Compare with regex
(last
arg).
200 {"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld"
201 "-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s}
202 {{objdump
{-dr
-m mips
:isa32r2
} tlsbin
-o32.d
} {objdump
-srj.got tlsbin
-o32.got
}}
204 {"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld"
205 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
206 {{objdump
{-dr
-m mips
:isa32r2
} tlslib
-o32.d
} {objdump
-Rsj.got tlslib
-o32.got
}}
208 {"Dynamic executable with TLS"
209 "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so"
210 "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s}
211 {{objdump
{-dr
-m mips
:isa32r2
} tlsdyn
-o32.d
} {objdump
-Rsj.got tlsdyn
-o32.got
}}
213 {"Shared library with multiple GOTs and TLS"
214 "-shared -melf32btsmip -T mips-lib.ld"
215 "-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s}
216 {{readelf
{-d
-r
} tls
-multi
-got
-1.r
}
217 {objdump
{-dr
-m mips
:isa32r2
} tls
-multi
-got
-1.d
}
218 {objdump
-Rsj.got tls
-multi
-got
-1.got
}}
220 {"Shared library with TLS and versioning"
221 "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver"
222 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
223 {{objdump
{-dr
-m mips
:isa32r2
} tlslib
-o32.d
} {objdump
-Rsj.got tlslib
-o32
-ver.got
}}
225 {"Dynamic executable with TLS and versioning"
226 "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so"
227 "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s}
228 {{objdump
{-dr
-m mips
:isa32r2
} tlsdyn
-o32
-1.d
} {objdump
-Rsj.got tlsdyn
-o32
-1.got
}}
229 "tls-dynamic-o32-ver"}
230 {"Dynamic executable with TLS and versioning (order 2)"
231 "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o"
232 "-EB -march=mips1 -32 -KPIC" {}
233 {{objdump
{-dr
-m mips
:isa32r2
} tlsdyn
-o32
-2.d
} {objdump
-Rsj.got tlsdyn
-o32
-2.got
}}
234 "tls-dynamic-o32-ver-2"}
235 {"Dynamic executable with TLS and versioning (order 3)"
236 "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o"
237 "-EB -march=mips1 -32 -KPIC" {}
238 {{objdump
{-dr
-m mips
:isa32r2
} tlsdyn
-o32
-3.d
} {objdump
-Rsj.got tlsdyn
-o32
-3.got
}}
239 "tls-dynamic-o32-ver-3"}
240 {"Shared library with TLS and hidden symbols"
241 "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver"
242 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
243 {{objdump
{-dr
-m mips
:isa32r2
} tlslib
-o32.d
} {objdump
-Rsj.got tlslib
-o32
-hidden.got
}}
244 "tlslib-o32-hidden.so"}
245 {"Shared library with TLS and hidden symbols (2)"
246 "-shared -melf32btsmip -T mips-lib.ld"
247 "-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s}
248 {{objdump
-drj.
text tls
-hidden2.d
} {objdump
-sj.got tls
-hidden2
-got.d
}}
250 {"Shared library with TLS and hidden symbols (3)"
251 "-shared -melf32btsmip -T tls-hidden3.ld"
252 "-EB -march=mips2 -32 -KPIC" {tls-hidden3a.s tls-hidden3b.s}
253 {{objdump
-dj.
text tls
-hidden3.d
} {objdump
-sj.got tls
-hidden3.got
}
254 {readelf
--relocs tls
-hidden3.r
}}
256 {"Shared library with TLS and hidden symbols (4)"
257 "-shared -melf32btsmip -T tls-hidden3.ld"
258 "-EB -march=mips2 -32 -KPIC" {tls-hidden4a.s tls-hidden4b.s}
259 {{objdump
-sj.got tls
-hidden4.got
} {readelf
--relocs tls
-hidden4.r
}}
263 if {[istarget mips
*-*-linux
*]} {
264 run_ld_link_tests $mips_tls_tests
267 set mips16_call_global_test
{
268 {"Global calls from mips16"
270 "-mips32r2" {mips16-call-global-1.s mips16-call-global-2.s mips16-call-global-3.s}
271 {{objdump
-dr mips16
-call-global.d
}}
272 "mips16-call-global"}
275 run_ld_link_tests $mips16_call_global_test
277 set mips16_intermix_test
{
278 {"Intermixing mips32 and mips16 functions"
280 "-mips32r2" {mips16-intermix-1.s mips16-intermix-2.s}
281 {{objdump
-t mips16
-intermix.d
}}
285 run_ld_link_tests $mips16_intermix_test
287 run_dump_test
"mips16-local-stubs-1"
289 run_dump_test
"attr-gnu-4-00"
290 run_dump_test
"attr-gnu-4-01"
291 run_dump_test
"attr-gnu-4-02"
292 run_dump_test
"attr-gnu-4-03"
293 run_dump_test
"attr-gnu-4-04"
294 run_dump_test
"attr-gnu-4-05"
295 run_dump_test
"attr-gnu-4-10"
296 run_dump_test
"attr-gnu-4-11"
297 run_dump_test
"attr-gnu-4-12"
298 run_dump_test
"attr-gnu-4-13"
299 run_dump_test
"attr-gnu-4-14"
300 run_dump_test
"attr-gnu-4-15"
301 run_dump_test
"attr-gnu-4-20"
302 run_dump_test
"attr-gnu-4-21"
303 run_dump_test
"attr-gnu-4-22"
304 run_dump_test
"attr-gnu-4-23"
305 run_dump_test
"attr-gnu-4-24"
306 run_dump_test
"attr-gnu-4-25"
307 run_dump_test
"attr-gnu-4-30"
308 run_dump_test
"attr-gnu-4-31"
309 run_dump_test
"attr-gnu-4-32"
310 run_dump_test
"attr-gnu-4-33"
311 run_dump_test
"attr-gnu-4-34"
312 run_dump_test
"attr-gnu-4-35"
313 run_dump_test
"attr-gnu-4-40"
314 run_dump_test
"attr-gnu-4-41"
315 run_dump_test
"attr-gnu-4-42"
316 run_dump_test
"attr-gnu-4-43"
317 run_dump_test
"attr-gnu-4-44"
318 run_dump_test
"attr-gnu-4-45"
319 run_dump_test
"attr-gnu-4-51"