New files.
[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"
353057a5
RS
110if {$has_newabi && $linux_gnu} {
111 run_dump_test "eh-frame1-n32"
112 run_dump_test "eh-frame1-n64"
dcf507a6
RS
113 run_dump_test "eh-frame2-n32"
114 run_dump_test "eh-frame2-n64"
353057a5 115}
8c946ed5
RS
116if {$embedded_elf} {
117 run_dump_test "eh-frame3"
118 run_dump_test "eh-frame4"
119}
0efd4160
ILT
120
121run_dump_test "jaloverflow"
c314987d 122run_dump_test "jaloverflow-2"
1f0f3e9b
RS
123if {$has_newabi} {
124 run_dump_test "jalbal"
125}
d6f16593
MR
126
127run_dump_test "mips16-hilo"
128if {$has_newabi} {
129 run_dump_test "mips16-hilo-n32"
130}
f4e584bd 131
cc27e1dc
EC
132if { $linux_gnu } {
133 run_dump_test "textrel-1"
134}
135
81d43bff
RS
136if $has_newabi {
137 run_dump_test "emit-relocs-1"
138}
139
f4e584bd
DJ
140# For tests which may involve multiple files, use run_ld_link_tests.
141
142# List contains test-items with 3 items followed by 2 lists:
143# 0:name 1:ld options 2:assembler options
144# 3:filenames of assembler files 4: action and options. 5: name of output file
145
146# Actions:
147# objdump: Apply objdump options on result. Compare with regex (last arg).
148# nm: Apply nm options on result. Compare with regex (last arg).
149# readelf: Apply readelf options on result. Compare with regex (last arg).
150
151set mips_tls_tests {
152 {"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld"
153 "-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s}
154 {{objdump {-dr -m mips:isa32r2} tlsbin-o32.d} {objdump -srj.got tlsbin-o32.got}}
155 "tls-static-o32"}
156 {"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld"
157 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
158 {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32.got}}
159 "tlslib-o32.so"}
160 {"Dynamic executable with TLS"
161 "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so"
162 "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s}
163 {{objdump {-dr -m mips:isa32r2} tlsdyn-o32.d} {objdump -Rsj.got tlsdyn-o32.got}}
164 "tls-dynamic-o32"}
165 {"Shared library with multiple GOTs and TLS"
166 "-shared -melf32btsmip -T mips-lib.ld"
167 "-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s}
168 {{readelf {-d -r} tls-multi-got-1.r}
169 {objdump {-dr -m mips:isa32r2} tls-multi-got-1.d}
170 {objdump -Rsj.got tls-multi-got-1.got}}
171 "tlslib-multi.so"}
172 {"Shared library with TLS and versioning"
173 "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver"
174 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
175 {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-ver.got}}
176 "tlslib-o32-ver.so"}
177 {"Dynamic executable with TLS and versioning"
178 "-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so"
179 "-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s}
180 {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-1.d} {objdump -Rsj.got tlsdyn-o32-1.got}}
181 "tls-dynamic-o32-ver"}
182 {"Dynamic executable with TLS and versioning (order 2)"
183 "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o"
184 "-EB -march=mips1 -32 -KPIC" {}
185 {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-2.d} {objdump -Rsj.got tlsdyn-o32-2.got}}
186 "tls-dynamic-o32-ver-2"}
187 {"Dynamic executable with TLS and versioning (order 3)"
188 "-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o"
189 "-EB -march=mips1 -32 -KPIC" {}
190 {{objdump {-dr -m mips:isa32r2} tlsdyn-o32-3.d} {objdump -Rsj.got tlsdyn-o32-3.got}}
191 "tls-dynamic-o32-ver-3"}
192 {"Shared library with TLS and hidden symbols"
193 "-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver"
194 "-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
195 {{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}}
196 "tlslib-o32-hidden.so"}
4005427f
RS
197 {"Shared library with TLS and hidden symbols (2)"
198 "-shared -melf32btsmip -T mips-lib.ld"
199 "-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s}
200 {{objdump -drj.text tls-hidden2.d} {objdump -sj.got tls-hidden2-got.d}}
201 "tls-hidden2.so"}
f4e584bd
DJ
202}
203
204if {[istarget mips*-*-linux*]} {
205 run_ld_link_tests $mips_tls_tests
206}
207
This page took 0.30737 seconds and 4 git commands to generate.