PR gprof/5147
[deliverable/binutils-gdb.git] / ld / testsuite / ld-mips-elf / mips-elf.exp
CommitLineData
a657e7c1 1# Expect script for MIPS ELF linker tests
f96b4a7b 2# Copyright 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
a657e7c1 3#
f96b4a7b
NC
4# This file is part of the GNU Binutils.
5#
6# This program is free software; you can redistribute it and/or modify
a657e7c1 7# it under the terms of the GNU General Public License as published by
f96b4a7b 8# the Free Software Foundation; either version 3 of the License, or
a657e7c1
CD
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
f96b4a7b
NC
18# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19# MA 02110-1301, USA.
a657e7c1
CD
20#
21
0a44bf69
RS
22if {[istarget "mips*-*-vxworks"]} {
23 set mipsvxtests {
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}
9e3313ae 27 {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
0a44bf69
RS
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"
8275b357 47 run_dump_test "vxworks-forced-local-1"
0a44bf69
RS
48 return
49}
50
fbf18a5c
TS
51if {![istarget mips*-*-*] || ![is_elf_format]} {
52 return
53}
30a2f863 54
fbf18a5c
TS
55set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]]
56set linux_gnu [expr [istarget mips*-*-linux*]]
57set embedded_elf [expr [istarget mips*-*-elf]]
30a2f863 58
30a2f863 59
fbf18a5c
TS
60# Check MIPS16 markings being passed through link.
61run_dump_test "mips16-1"
8914585c 62
fbf18a5c
TS
63# MIPS branch offset final link checking.
64run_dump_test "branch-misc-1"
7d6c7577 65
732be173
DJ
66# Test multi-got link. We only do this on GNU/Linux because it requires
67# the "traditional" emulations.
68if { $linux_gnu } {
69 run_dump_test "multi-got-1"
bbe506e8 70 run_dump_test "multi-got-no-shared"
732be173 71}
30a2f863 72
fbf18a5c
TS
73if $has_newabi {
74 run_dump_test "elf-rel-got-n32"
75 run_dump_test "elf-rel-xgot-n32"
48fe7bda 76 if { $linux_gnu } {
fbf18a5c
TS
77 run_dump_test "elf-rel-got-n64-linux"
78 run_dump_test "elf-rel-xgot-n64-linux"
79 } else {
80 run_dump_test "elf-rel-got-n64"
81 run_dump_test "elf-rel-xgot-n64"
48fe7bda
AO
82 }
83
fbf18a5c
TS
84 run_dump_test "relax-jalr-n32"
85 run_dump_test "relax-jalr-n32-shared"
86 run_dump_test "relax-jalr-n64"
87 run_dump_test "relax-jalr-n64-shared"
88}
48fe7bda 89
fbf18a5c
TS
90if { $linux_gnu } {
91 run_dump_test "rel32-o32"
92 run_dump_test "rel32-n32"
93 run_dump_test "rel64"
94}
a657e7c1 95
fbf18a5c 96if { $embedded_elf } {
fbf18a5c 97 run_dump_test "region1"
a657e7c1 98}
18ab1921
RS
99
100if $embedded_elf {
101 # This could work on other targets too, but would need the appropriate
102 # ld -m switch.
103 run_dump_test "reloc-1-rel"
104}
105if $has_newabi {
106 run_dump_test "reloc-1-n32"
107 if $linux_gnu {
108 # Uses a linux-specific ld -m switch
109 run_dump_test "reloc-1-n64"
110 }
111}
112run_dump_test "reloc-2"
17a6716a 113run_dump_test "reloc-merge-lo16"
3b788261
TS
114run_dump_test "reloc-3"
115if {$has_newabi} {
116 run_dump_test "reloc-3-n32"
117}
43ec5bc0
AN
118run_dump_test "reloc-4"
119run_dump_test "reloc-5"
120
353057a5
RS
121if {$has_newabi && $linux_gnu} {
122 run_dump_test "eh-frame1-n32"
123 run_dump_test "eh-frame1-n64"
dcf507a6
RS
124 run_dump_test "eh-frame2-n32"
125 run_dump_test "eh-frame2-n64"
353057a5 126}
8c946ed5
RS
127if {$embedded_elf} {
128 run_dump_test "eh-frame3"
129 run_dump_test "eh-frame4"
130}
0efd4160
ILT
131
132run_dump_test "jaloverflow"
c314987d 133run_dump_test "jaloverflow-2"
1f0f3e9b
RS
134if {$has_newabi} {
135 run_dump_test "jalbal"
136}
d6f16593
MR
137
138run_dump_test "mips16-hilo"
139if {$has_newabi} {
140 run_dump_test "mips16-hilo-n32"
141}
f4e584bd 142
cc27e1dc
EC
143if { $linux_gnu } {
144 run_dump_test "textrel-1"
145}
146
81d43bff
RS
147if $has_newabi {
148 run_dump_test "emit-relocs-1"
149}
150
73934d31
RS
151run_dump_test "hash1a"
152run_dump_test "hash1b"
153run_dump_test "hash1c"
154
5108fc1b
RS
155if {[istarget mips*-*-linux*]} {
156 # The number of symbols that are always included in the symbol table
74541ad4 157 # for these tests. The 4 are:
5108fc1b
RS
158 #
159 # the null symbol entry
160 # the .MIPS.stubs section symbol
5108fc1b
RS
161 # _gp
162 # _GLOBAL_OFFSET_TABLE_
74541ad4 163 set base_syms 4
5108fc1b
RS
164 foreach dynsym { 7fff 8000 fff0 10000 2fe80 } {
165 run_ld_link_tests \
166 [list [list \
167 "Stub for dynsym 0x$dynsym" \
168 "-shared -melf32btsmip -T stub-dynsym-1.ld" \
169 [concat \
170 "-EB -march=mips1 -32 -KPIC" \
171 "--defsym base_syms=$base_syms" \
172 "--defsym dynsym=0x$dynsym"] \
173 [list "stub-dynsym-1.s"] \
174 [list [list \
175 "objdump" "-dz" \
176 "stub-dynsym-1-$dynsym.d"]] \
177 "stub-dynsym-1-$dynsym"]]
178 }
179 }
180
f4e584bd
DJ
181# For tests which may involve multiple files, use run_ld_link_tests.
182
183# List contains test-items with 3 items followed by 2 lists:
184# 0:name 1:ld options 2:assembler options
185# 3:filenames of assembler files 4: action and options. 5: name of output file
186
187# Actions:
188# objdump: Apply objdump options on result. Compare with regex (last arg).
189# nm: Apply nm options on result. Compare with regex (last arg).
190# readelf: Apply readelf options on result. Compare with regex (last arg).
191
192set mips_tls_tests {
193 {"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld"
194 "-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s}
195 {{objdump {-dr -m mips:isa32r2} tlsbin-o32.d} {objdump -srj.got tlsbin-o32.got}}
196 "tls-static-o32"}
197 {"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld"
198 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
199 {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32.got}}
200 "tlslib-o32.so"}
201 {"Dynamic executable with TLS"
202 "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so"
203 "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s}
204 {{objdump {-dr -m mips:isa32r2} tlsdyn-o32.d} {objdump -Rsj.got tlsdyn-o32.got}}
205 "tls-dynamic-o32"}
206 {"Shared library with multiple GOTs and TLS"
207 "-shared -melf32btsmip -T mips-lib.ld"
208 "-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s}
209 {{readelf {-d -r} tls-multi-got-1.r}
210 {objdump {-dr -m mips:isa32r2} tls-multi-got-1.d}
211 {objdump -Rsj.got tls-multi-got-1.got}}
212 "tlslib-multi.so"}
213 {"Shared library with TLS and versioning"
214 "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver"
215 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
216 {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-ver.got}}
217 "tlslib-o32-ver.so"}
218 {"Dynamic executable with TLS and versioning"
219 "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so"
220 "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s}
221 {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-1.d} {objdump -Rsj.got tlsdyn-o32-1.got}}
222 "tls-dynamic-o32-ver"}
223 {"Dynamic executable with TLS and versioning (order 2)"
224 "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o"
225 "-EB -march=mips1 -32 -KPIC" {}
226 {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-2.d} {objdump -Rsj.got tlsdyn-o32-2.got}}
227 "tls-dynamic-o32-ver-2"}
228 {"Dynamic executable with TLS and versioning (order 3)"
229 "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o"
230 "-EB -march=mips1 -32 -KPIC" {}
231 {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-3.d} {objdump -Rsj.got tlsdyn-o32-3.got}}
232 "tls-dynamic-o32-ver-3"}
233 {"Shared library with TLS and hidden symbols"
234 "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver"
235 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
236 {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}}
237 "tlslib-o32-hidden.so"}
4005427f
RS
238 {"Shared library with TLS and hidden symbols (2)"
239 "-shared -melf32btsmip -T mips-lib.ld"
240 "-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s}
241 {{objdump -drj.text tls-hidden2.d} {objdump -sj.got tls-hidden2-got.d}}
242 "tls-hidden2.so"}
ead49a57
RS
243 {"Shared library with TLS and hidden symbols (3)"
244 "-shared -melf32btsmip -T tls-hidden3.ld"
245 "-EB -march=mips2 -32 -KPIC" {tls-hidden3a.s tls-hidden3b.s}
246 {{objdump -dj.text tls-hidden3.d} {objdump -sj.got tls-hidden3.got}
247 {readelf --relocs tls-hidden3.r}}
248 "tls-hidden3.so"}
249 {"Shared library with TLS and hidden symbols (4)"
250 "-shared -melf32btsmip -T tls-hidden3.ld"
251 "-EB -march=mips2 -32 -KPIC" {tls-hidden4a.s tls-hidden4b.s}
252 {{objdump -sj.got tls-hidden4.got} {readelf --relocs tls-hidden4.r}}
253 "tls-hidden4.so"}
f4e584bd
DJ
254}
255
256if {[istarget mips*-*-linux*]} {
257 run_ld_link_tests $mips_tls_tests
258}
259
35d3d567
TS
260set mips16_call_global_test {
261 {"Global calls from mips16"
262 ""
263 "-mips32r2" {mips16-call-global-1.s mips16-call-global-2.s mips16-call-global-3.s}
264 {{objdump -dr mips16-call-global.d}}
265 "mips16-call-global"}
266}
267
268run_ld_link_tests $mips16_call_global_test
b9d58d71
TS
269
270set mips16_intermix_test {
271 {"Intermixing mips32 and mips16 functions"
272 ""
273 "-mips32r2" {mips16-intermix-1.s mips16-intermix-2.s}
274 {{objdump -t mips16-intermix.d}}
275 "mips16-intermix"}
276}
277
278run_ld_link_tests $mips16_intermix_test
b314ec0e
RS
279
280run_dump_test "mips16-local-stubs-1"
2cf19d5c
JM
281
282run_dump_test "attr-gnu-4-00"
283run_dump_test "attr-gnu-4-01"
284run_dump_test "attr-gnu-4-02"
285run_dump_test "attr-gnu-4-03"
286run_dump_test "attr-gnu-4-10"
287run_dump_test "attr-gnu-4-11"
288run_dump_test "attr-gnu-4-12"
289run_dump_test "attr-gnu-4-13"
290run_dump_test "attr-gnu-4-14"
291run_dump_test "attr-gnu-4-20"
292run_dump_test "attr-gnu-4-21"
293run_dump_test "attr-gnu-4-22"
294run_dump_test "attr-gnu-4-23"
295run_dump_test "attr-gnu-4-30"
296run_dump_test "attr-gnu-4-31"
297run_dump_test "attr-gnu-4-32"
298run_dump_test "attr-gnu-4-33"
299run_dump_test "attr-gnu-4-41"
This page took 0.328927 seconds and 4 git commands to generate.