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