1 |
84 |
khays |
# Expect script for MIPS ELF linker tests
|
2 |
|
|
# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
3 |
|
|
# Free Software Foundation, Inc.
|
4 |
|
|
#
|
5 |
|
|
# This file is part of the GNU Binutils.
|
6 |
|
|
#
|
7 |
|
|
# This program is free software; you can redistribute it and/or modify
|
8 |
|
|
# it under the terms of the GNU General Public License as published by
|
9 |
|
|
# the Free Software Foundation; either version 3 of the License, or
|
10 |
|
|
# (at your option) any later version.
|
11 |
|
|
#
|
12 |
|
|
# This program is distributed in the hope that it will be useful,
|
13 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
# GNU General Public License for more details.
|
16 |
|
|
#
|
17 |
|
|
# You should have received a copy of the GNU General Public License
|
18 |
|
|
# along with this program; if not, write to the Free Software
|
19 |
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
20 |
|
|
# MA 02110-1301, USA.
|
21 |
|
|
#
|
22 |
|
|
|
23 |
|
|
if {[istarget "mips*-*-vxworks"]} {
|
24 |
|
|
set mipsvxtests {
|
25 |
|
|
{"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
|
26 |
|
|
"-mips2" {vxworks1-lib.s}
|
27 |
|
|
{{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
|
28 |
|
|
{readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
|
29 |
|
|
"libvxworks1.so"}
|
30 |
|
|
{"VxWorks executable test 1 (dynamic)" \
|
31 |
|
|
"tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
|
32 |
|
|
"-mips2" {vxworks1.s}
|
33 |
|
|
{{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
|
34 |
|
|
"vxworks1"}
|
35 |
|
|
{"VxWorks executable test 2 (dynamic)" \
|
36 |
|
|
"-Tvxworks1.ld -q --force-dynamic"
|
37 |
|
|
"-mips2" {vxworks2.s}
|
38 |
|
|
{{readelf --segments vxworks2.sd}}
|
39 |
|
|
"vxworks2"}
|
40 |
|
|
{"VxWorks executable test 2 (static)"
|
41 |
|
|
"-Tvxworks1.ld"
|
42 |
|
|
"-mips2" {vxworks2.s}
|
43 |
|
|
{{readelf --segments vxworks2-static.sd}}
|
44 |
|
|
"vxworks2"}
|
45 |
|
|
}
|
46 |
|
|
run_ld_link_tests $mipsvxtests
|
47 |
|
|
run_dump_test "vxworks1-static"
|
48 |
|
|
run_dump_test "vxworks-forced-local-1"
|
49 |
|
|
return
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
if {![istarget mips*-*-*] || ![is_elf_format]} {
|
53 |
|
|
return
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]]
|
57 |
|
|
set linux_gnu [expr [istarget mips*-*-linux*]]
|
58 |
|
|
set embedded_elf [expr [istarget mips*-*-elf]]
|
59 |
|
|
|
60 |
|
|
if { $linux_gnu } {
|
61 |
|
|
run_ld_link_tests [list \
|
62 |
|
|
[list "Dummy shared library for MIPS16 PIC test 1" \
|
63 |
|
|
"-shared -melf32btsmip" \
|
64 |
|
|
"-EB -32 -mips1" \
|
65 |
|
|
{ mips16-pic-1-dummy.s } \
|
66 |
|
|
{} \
|
67 |
|
|
"mips16-pic-1-dummy.so"] \
|
68 |
|
|
[list "MIPS16 PIC test 1" \
|
69 |
|
|
"-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-1-dummy.so" \
|
70 |
|
|
"-EB -32 -mips1 -I $srcdir/$subdir" \
|
71 |
|
|
{ mips16-pic-1a.s mips16-pic-1b.s } \
|
72 |
|
|
{ { objdump { -dr -j.text } mips16-pic-1.dd }
|
73 |
|
|
{ readelf -A mips16-pic-1.gd } } \
|
74 |
|
|
"mips16-pic-1"] \
|
75 |
|
|
[list "MIPS16 PIC test 2" \
|
76 |
|
|
"-melf32btsmip -T mips16-pic-1.ld -shared" \
|
77 |
|
|
"-EB -32 -mips1 -I $srcdir/$subdir" \
|
78 |
|
|
{ mips16-pic-2a.s mips16-pic-2b.s } \
|
79 |
|
|
{ { objdump { -dr -j.text } mips16-pic-2.dd } \
|
80 |
|
|
{ readelf -A mips16-pic-2.gd } \
|
81 |
|
|
{ readelf --symbols mips16-pic-2.nd } \
|
82 |
|
|
{ readelf --relocs mips16-pic-2.rd } \
|
83 |
|
|
{ readelf -d mips16-pic-2.ad } } \
|
84 |
|
|
"mips16-pic-2"] \
|
85 |
|
|
[list "MIPS16 PIC test 3" \
|
86 |
|
|
"-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-1-dummy.so" \
|
87 |
|
|
"-EB -32 -mips1 -I $srcdir/$subdir" \
|
88 |
|
|
{ mips16-pic-3a.s mips16-pic-3b.s } \
|
89 |
|
|
{ { objdump -dr mips16-pic-3.dd } \
|
90 |
|
|
{ readelf --relocs mips16-pic-3.rd } \
|
91 |
|
|
{ readelf -A mips16-pic-3.gd } } \
|
92 |
|
|
"mips16-pic-3"] \
|
93 |
|
|
[list "MIPS16 PIC test 4 (shared library)" \
|
94 |
|
|
"-shared -melf32btsmip -T mips16-pic-1.ld --version-script mips16-pic-4.ver" \
|
95 |
|
|
"-EB -32 -mips1" \
|
96 |
|
|
{ mips16-pic-4a.s mips16-pic-4b.s } \
|
97 |
|
|
{ { objdump -dr mips16-pic-4a.dd } \
|
98 |
|
|
{ readelf --symbols mips16-pic-4a.nd } \
|
99 |
|
|
{ readelf -A mips16-pic-4a.gd } } \
|
100 |
|
|
"mips16-pic-4.so"] \
|
101 |
|
|
[list "MIPS16 PIC test 4 (executable)" \
|
102 |
|
|
"-melf32btsmip -T mips16-pic-1.ld tmpdir/mips16-pic-4.so" \
|
103 |
|
|
"-EB -32 -mips1" \
|
104 |
|
|
{ mips16-pic-4c.s } \
|
105 |
|
|
{ { objdump -dr mips16-pic-4b.dd } } \
|
106 |
|
|
"mips16-pic-4"]]
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
if { [istarget mips64*-linux-gnu] } {
|
110 |
|
|
set o32_as_flags "-32 -EB"
|
111 |
|
|
set o32_ld_flags "-melf32btsmip"
|
112 |
|
|
} elseif { [istarget mips64*-*freebsd*] } {
|
113 |
|
|
set o32_as_flags "-32 -EB"
|
114 |
|
|
set o32_ld_flags "-melf32btsmip_fbsd"
|
115 |
|
|
} else {
|
116 |
|
|
set o32_as_flags ""
|
117 |
|
|
set o32_ld_flags ""
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
# Check MIPS16 markings being passed through link.
|
121 |
|
|
run_dump_test "mips16-1"
|
122 |
|
|
|
123 |
|
|
# MIPS branch offset final link checking.
|
124 |
|
|
run_dump_test "branch-misc-1"
|
125 |
|
|
|
126 |
|
|
# Test multi-got link. We only do this on GNU/Linux because it requires
|
127 |
|
|
# the "traditional" emulations.
|
128 |
|
|
if { $linux_gnu } {
|
129 |
|
|
run_dump_test "multi-got-1"
|
130 |
|
|
run_dump_test "multi-got-no-shared"
|
131 |
|
|
run_dump_test "multi-got-hidden-1"
|
132 |
|
|
run_dump_test "multi-got-hidden-2"
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
# Test __gnu_local_gp accesses
|
136 |
|
|
if { $linux_gnu } {
|
137 |
|
|
run_dump_test "no-shared-1-o32"
|
138 |
|
|
if { $has_newabi } {
|
139 |
|
|
run_dump_test "no-shared-1-n32"
|
140 |
|
|
run_dump_test "no-shared-1-n64"
|
141 |
|
|
}
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
if $has_newabi {
|
145 |
|
|
run_dump_test "elf-rel-got-n32"
|
146 |
|
|
run_dump_test "elf-rel-xgot-n32"
|
147 |
|
|
if { $linux_gnu } {
|
148 |
|
|
run_dump_test "elf-rel-got-n64-linux"
|
149 |
|
|
run_dump_test "elf-rel-xgot-n64-linux"
|
150 |
|
|
} else {
|
151 |
|
|
run_dump_test "elf-rel-got-n64"
|
152 |
|
|
run_dump_test "elf-rel-xgot-n64"
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
run_dump_test "relax-jalr-n32"
|
156 |
|
|
run_dump_test "relax-jalr-n32-shared"
|
157 |
|
|
run_dump_test "relax-jalr-n64"
|
158 |
|
|
run_dump_test "relax-jalr-n64-shared"
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
if { $linux_gnu } {
|
162 |
|
|
run_dump_test "rel32-o32"
|
163 |
|
|
if { $has_newabi } {
|
164 |
|
|
run_dump_test "rel32-n32"
|
165 |
|
|
run_dump_test "rel64"
|
166 |
|
|
}
|
167 |
|
|
# The first test checks that a mixed PIC/non-PIC relocatable link
|
168 |
|
|
# will not introduce any stubs itself, but will flag PIC functions
|
169 |
|
|
# for the final link.
|
170 |
|
|
#
|
171 |
|
|
# The second test checks that we insert stubs for calls from
|
172 |
|
|
# non-PIC functions to PIC functions when linking the original
|
173 |
|
|
# two objects together.
|
174 |
|
|
#
|
175 |
|
|
# The third test checks that we do the same when linking the
|
176 |
|
|
# result of the first link (with no other source files).
|
177 |
|
|
run_ld_link_tests {
|
178 |
|
|
{"PIC and non-PIC test 1 (relocatable)" "-r -melf32btsmip"
|
179 |
|
|
"-32 -EB -mips2" {pic-and-nonpic-1a.s pic-and-nonpic-1b.s}
|
180 |
|
|
{{objdump -dr pic-and-nonpic-1-rel.dd}
|
181 |
|
|
{readelf --symbols pic-and-nonpic-1-rel.nd}}
|
182 |
|
|
"pic-and-nonpic-1-rel.o"}
|
183 |
|
|
{"PIC and non-PIC test 1 (static 1)"
|
184 |
|
|
"-melf32btsmip -Tpic-and-nonpic-1.ld"
|
185 |
|
|
"-32 -EB -mips2" {pic-and-nonpic-1a.s pic-and-nonpic-1b.s}
|
186 |
|
|
{{objdump -dr pic-and-nonpic-1.dd}
|
187 |
|
|
{readelf --symbols pic-and-nonpic-1.nd}}
|
188 |
|
|
"pic-and-nonpic-1-static1.o"}
|
189 |
|
|
{"PIC and non-PIC test 1 (static 2)"
|
190 |
|
|
"-melf32btsmip -Tpic-and-nonpic-1.ld tmpdir/pic-and-nonpic-1-rel.o"
|
191 |
|
|
"" {}
|
192 |
|
|
{{objdump -dr pic-and-nonpic-1.dd}
|
193 |
|
|
{readelf --symbols pic-and-nonpic-1.nd}}
|
194 |
|
|
"pic-and-nonpic-1-static2.o"}
|
195 |
|
|
}
|
196 |
|
|
run_dump_test "pic-and-nonpic-2"
|
197 |
|
|
run_ld_link_tests {
|
198 |
|
|
{"PIC and non-PIC test 3 (shared library)"
|
199 |
|
|
"-melf32btsmip -shared -Tpic-and-nonpic-3a.ld"
|
200 |
|
|
"-32 -EB -mips2" {pic-and-nonpic-3a.s}
|
201 |
|
|
{{readelf --segments pic-and-nonpic-3a.sd}
|
202 |
|
|
{readelf -A pic-and-nonpic-3a.gd}
|
203 |
|
|
{objdump -dr pic-and-nonpic-3a.dd}}
|
204 |
|
|
"pic-and-nonpic-3a.so"}
|
205 |
|
|
{"PIC and non-PIC test 3 (executable)"
|
206 |
|
|
"-melf32btsmip -Tpic-and-nonpic-3b.ld tmpdir/pic-and-nonpic-3a.so"
|
207 |
|
|
"-32 -EB -mips2" {pic-and-nonpic-3b.s}
|
208 |
|
|
{{readelf --segments pic-and-nonpic-3b.sd}
|
209 |
|
|
{objdump -dr pic-and-nonpic-3b.dd}
|
210 |
|
|
{objdump {-s -j.got.plt} pic-and-nonpic-3b.pd}
|
211 |
|
|
{readelf -A pic-and-nonpic-3b.gd}
|
212 |
|
|
{readelf --relocs pic-and-nonpic-3b.rd}
|
213 |
|
|
{readelf --symbols pic-and-nonpic-3b.nd}
|
214 |
|
|
{readelf -d pic-and-nonpic-3b.ad}}
|
215 |
|
|
"pic-and-nonpic-3b"}
|
216 |
|
|
}
|
217 |
|
|
run_dump_test "pic-and-nonpic-3-error"
|
218 |
|
|
run_ld_link_tests {
|
219 |
|
|
{"PIC and non-PIC test 4 (shared library)"
|
220 |
|
|
"-melf32btsmip -shared -Tpic-and-nonpic-3a.ld"
|
221 |
|
|
"-32 -EB -mips2" {pic-and-nonpic-4a.s}
|
222 |
|
|
{}
|
223 |
|
|
"pic-and-nonpic-4a.so"}
|
224 |
|
|
{"PIC and non-PIC test 4 (executable)"
|
225 |
|
|
"-melf32btsmip -Tpic-and-nonpic-4b.ld tmpdir/pic-and-nonpic-4a.so"
|
226 |
|
|
"-32 -EB -mips2" {pic-and-nonpic-4b.s}
|
227 |
|
|
{{readelf --segments pic-and-nonpic-4b.sd}
|
228 |
|
|
{objdump -dr pic-and-nonpic-4b.dd}
|
229 |
|
|
{objdump {-s -j.got -j.data} pic-and-nonpic-4b.gd}
|
230 |
|
|
{readelf --relocs pic-and-nonpic-4b.rd}
|
231 |
|
|
{readelf --symbols pic-and-nonpic-4b.nd}
|
232 |
|
|
{readelf -d pic-and-nonpic-4b.ad}}
|
233 |
|
|
"pic-and-nonpic-4b"}
|
234 |
|
|
}
|
235 |
|
|
run_dump_test "pic-and-nonpic-4-error"
|
236 |
|
|
run_ld_link_tests {
|
237 |
|
|
{"PIC and non-PIC test 5 (executable)"
|
238 |
|
|
"-melf32btsmip -Tpic-and-nonpic-5b.ld tmpdir/pic-and-nonpic-3a.so tmpdir/pic-and-nonpic-4a.so"
|
239 |
|
|
"-32 -EB -mips2" {pic-and-nonpic-5a.s pic-and-nonpic-5b.s}
|
240 |
|
|
{{readelf --segments pic-and-nonpic-5b.sd}
|
241 |
|
|
{objdump -dr pic-and-nonpic-5b.dd}
|
242 |
|
|
{objdump {-s -j.got.plt -j.data} pic-and-nonpic-5b.pd}
|
243 |
|
|
{readelf -A pic-and-nonpic-5b.gd}
|
244 |
|
|
{readelf --relocs pic-and-nonpic-5b.rd}
|
245 |
|
|
{readelf --symbols pic-and-nonpic-5b.nd}
|
246 |
|
|
{readelf -d pic-and-nonpic-5b.ad}}
|
247 |
|
|
"pic-and-nonpic-5b"}
|
248 |
|
|
}
|
249 |
|
|
set abis { o32 -32 elf32btsmip }
|
250 |
|
|
if $has_newabi {
|
251 |
|
|
lappend abis n32 -n32 elf32btsmipn32
|
252 |
|
|
lappend abis n64 -64 elf64btsmip
|
253 |
|
|
}
|
254 |
|
|
foreach { abi flag emul } $abis {
|
255 |
|
|
run_ld_link_tests [list \
|
256 |
|
|
[list "PIC and non-PIC test 6 ($abi shared library)" \
|
257 |
|
|
"-m$emul -shared -Tpic-and-nonpic-3a.ld" \
|
258 |
|
|
"$flag -EB -mips3" \
|
259 |
|
|
[list "pic-and-nonpic-6-${abi}a.s"] {} \
|
260 |
|
|
"pic-and-nonpic-6-${abi}.so"] \
|
261 |
|
|
[list "PIC and non-PIC test 6 ($abi executable)" \
|
262 |
|
|
"-m$emul -Tpic-and-nonpic-6.ld tmpdir/pic-and-nonpic-6-${abi}.so" \
|
263 |
|
|
"$flag -EB -mips3" \
|
264 |
|
|
[list "pic-and-nonpic-6-${abi}b.s" \
|
265 |
|
|
"pic-and-nonpic-6-${abi}c.s"] \
|
266 |
|
|
[list "readelf {--wide --segments} pic-and-nonpic-6-${abi}.sd" \
|
267 |
|
|
"objdump -dr pic-and-nonpic-6-${abi}.dd" \
|
268 |
|
|
"objdump {-s -j.got.plt} pic-and-nonpic-6-${abi}.pd" \
|
269 |
|
|
"readelf -A pic-and-nonpic-6-${abi}.gd" \
|
270 |
|
|
"readelf --relocs pic-and-nonpic-6-${abi}.rd" \
|
271 |
|
|
"readelf --symbols pic-and-nonpic-6-${abi}.nd" \
|
272 |
|
|
"readelf -d pic-and-nonpic-6-${abi}.ad"] \
|
273 |
|
|
"pic-and-nonpic-6-${abi}"]]
|
274 |
|
|
}
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
if { $embedded_elf } {
|
278 |
|
|
run_dump_test "region1"
|
279 |
|
|
}
|
280 |
|
|
|
281 |
|
|
if $embedded_elf {
|
282 |
|
|
# This could work on other targets too, but would need the appropriate
|
283 |
|
|
# ld -m switch.
|
284 |
|
|
run_dump_test "reloc-1-rel"
|
285 |
|
|
}
|
286 |
|
|
if $has_newabi {
|
287 |
|
|
run_dump_test "reloc-1-n32"
|
288 |
|
|
if $linux_gnu {
|
289 |
|
|
# Uses a linux-specific ld -m switch
|
290 |
|
|
run_dump_test "reloc-1-n64"
|
291 |
|
|
}
|
292 |
|
|
}
|
293 |
|
|
run_dump_test "reloc-2"
|
294 |
|
|
run_dump_test "reloc-merge-lo16"
|
295 |
|
|
run_dump_test "reloc-3"
|
296 |
|
|
if {$has_newabi} {
|
297 |
|
|
run_dump_test "reloc-3-n32"
|
298 |
|
|
}
|
299 |
|
|
run_dump_test "reloc-4"
|
300 |
|
|
run_dump_test "reloc-5"
|
301 |
|
|
if { $has_newabi } {
|
302 |
|
|
run_ld_link_tests {
|
303 |
|
|
{"reloc test 6a" "-shared"
|
304 |
|
|
"-n32" "reloc-6a.s"
|
305 |
|
|
{}
|
306 |
|
|
"reloc-6a.so"}
|
307 |
|
|
{"reloc test 6b" "tmpdir/reloc-6a.so"
|
308 |
|
|
"-n32" "reloc-6b.s"
|
309 |
|
|
{}
|
310 |
|
|
"reloc-6b"}
|
311 |
|
|
}
|
312 |
|
|
}
|
313 |
|
|
|
314 |
|
|
if {$has_newabi && $linux_gnu} {
|
315 |
|
|
run_dump_test "eh-frame1-n32"
|
316 |
|
|
run_dump_test "eh-frame1-n64"
|
317 |
|
|
run_dump_test "eh-frame2-n32"
|
318 |
|
|
run_dump_test "eh-frame2-n64"
|
319 |
|
|
}
|
320 |
|
|
if {$embedded_elf} {
|
321 |
|
|
run_dump_test "eh-frame3"
|
322 |
|
|
run_dump_test "eh-frame4"
|
323 |
|
|
}
|
324 |
|
|
if {$linux_gnu} {
|
325 |
|
|
set eh_frame5_test {
|
326 |
|
|
{"MIPS eh-frame 5"
|
327 |
|
|
"-melf32btsmip -shared -Teh-frame5.ld"
|
328 |
|
|
"-32 -EB"
|
329 |
|
|
{eh-frame5.s}
|
330 |
|
|
{{readelf {--relocs -wf} eh-frame5.d}}
|
331 |
|
|
"eh-frame5.so"}
|
332 |
|
|
}
|
333 |
|
|
run_ld_link_tests $eh_frame5_test
|
334 |
|
|
}
|
335 |
|
|
|
336 |
|
|
run_dump_test "jaloverflow"
|
337 |
|
|
run_dump_test "jaloverflow-2"
|
338 |
|
|
if {$has_newabi} {
|
339 |
|
|
run_dump_test "jalbal"
|
340 |
|
|
}
|
341 |
|
|
|
342 |
|
|
run_dump_test "mode-change-error-1"
|
343 |
|
|
|
344 |
|
|
run_dump_test "mips16-hilo"
|
345 |
|
|
if {$has_newabi} {
|
346 |
|
|
run_dump_test "mips16-hilo-n32"
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
if { $linux_gnu } {
|
350 |
|
|
if { $has_newabi } {
|
351 |
|
|
run_dump_test "textrel-1"
|
352 |
|
|
}
|
353 |
|
|
run_dump_test "got-page-1"
|
354 |
|
|
if $has_newabi {
|
355 |
|
|
run_dump_test "got-page-2"
|
356 |
|
|
run_dump_test "dyn-sec64"
|
357 |
|
|
}
|
358 |
|
|
run_dump_test "got-page-3"
|
359 |
|
|
run_dump_test "got-dump-1"
|
360 |
|
|
if $has_newabi {
|
361 |
|
|
run_dump_test "got-dump-2"
|
362 |
|
|
}
|
363 |
|
|
run_dump_test "reloc-estimate-1"
|
364 |
|
|
}
|
365 |
|
|
|
366 |
|
|
if $has_newabi {
|
367 |
|
|
run_dump_test "emit-relocs-1"
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
run_dump_test "hash1a"
|
371 |
|
|
run_dump_test "hash1b"
|
372 |
|
|
run_dump_test "hash1c"
|
373 |
|
|
|
374 |
|
|
if {[istarget mips*-*-linux*]} {
|
375 |
|
|
# The number of symbols that are always included in the symbol table
|
376 |
|
|
# for these tests. The 4 are:
|
377 |
|
|
#
|
378 |
|
|
# the null symbol entry
|
379 |
|
|
# the .MIPS.stubs section symbol
|
380 |
|
|
# _gp
|
381 |
|
|
# _GLOBAL_OFFSET_TABLE_
|
382 |
|
|
set base_syms 4
|
383 |
|
|
foreach dynsym { 7fff 8000 fff0 10000 2fe80 } {
|
384 |
|
|
run_ld_link_tests \
|
385 |
|
|
[list [list \
|
386 |
|
|
"Stub for dynsym 0x$dynsym" \
|
387 |
|
|
"-shared -melf32btsmip -T stub-dynsym-1.ld" \
|
388 |
|
|
[concat \
|
389 |
|
|
"-EB -march=mips1 -32 -KPIC" \
|
390 |
|
|
"--defsym base_syms=$base_syms" \
|
391 |
|
|
"--defsym dynsym=0x$dynsym"] \
|
392 |
|
|
[list "stub-dynsym-1.s"] \
|
393 |
|
|
[list [list \
|
394 |
|
|
"objdump" "-dz" \
|
395 |
|
|
"stub-dynsym-1-$dynsym.d"]] \
|
396 |
|
|
"stub-dynsym-1-$dynsym"]]
|
397 |
|
|
}
|
398 |
|
|
}
|
399 |
|
|
|
400 |
|
|
# For tests which may involve multiple files, use run_ld_link_tests.
|
401 |
|
|
|
402 |
|
|
# List contains test-items with 3 items followed by 2 lists:
|
403 |
|
|
# 0:name 1:ld options 2:assembler options
|
404 |
|
|
# 3:filenames of assembler files 4: action and options. 5: name of output file
|
405 |
|
|
|
406 |
|
|
# Actions:
|
407 |
|
|
# objdump: Apply objdump options on result. Compare with regex (last arg).
|
408 |
|
|
# nm: Apply nm options on result. Compare with regex (last arg).
|
409 |
|
|
# readelf: Apply readelf options on result. Compare with regex (last arg).
|
410 |
|
|
|
411 |
|
|
set mips_tls_tests {
|
412 |
|
|
{"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld"
|
413 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s}
|
414 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsbin-o32.d} {objdump -srj.got tlsbin-o32.got}}
|
415 |
|
|
"tls-static-o32"}
|
416 |
|
|
{"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld"
|
417 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
418 |
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32.got}}
|
419 |
|
|
"tlslib-o32.so"}
|
420 |
|
|
{"Dynamic executable with TLS"
|
421 |
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so"
|
422 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s}
|
423 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32.d} {objdump -Rsj.got tlsdyn-o32.got}}
|
424 |
|
|
"tls-dynamic-o32"}
|
425 |
|
|
{"Shared library with multiple GOTs and TLS"
|
426 |
|
|
"-shared -melf32btsmip -T mips-lib.ld"
|
427 |
|
|
"-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s}
|
428 |
|
|
{{readelf {-d -r} tls-multi-got-1.r}
|
429 |
|
|
{objdump {-dr -m mips:isa32r2} tls-multi-got-1.d}
|
430 |
|
|
{objdump -Rsj.got tls-multi-got-1.got}}
|
431 |
|
|
"tlslib-multi.so"}
|
432 |
|
|
{"Shared library with TLS and versioning"
|
433 |
|
|
"-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver"
|
434 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
435 |
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-ver.got}}
|
436 |
|
|
"tlslib-o32-ver.so"}
|
437 |
|
|
{"Dynamic executable with TLS and versioning"
|
438 |
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so"
|
439 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s}
|
440 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-1.d} {objdump -Rsj.got tlsdyn-o32-1.got}}
|
441 |
|
|
"tls-dynamic-o32-ver"}
|
442 |
|
|
{"Dynamic executable with TLS and versioning (order 2)"
|
443 |
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o"
|
444 |
|
|
"-EB -march=mips1 -32 -KPIC" {}
|
445 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-2.d} {objdump -Rsj.got tlsdyn-o32-2.got}}
|
446 |
|
|
"tls-dynamic-o32-ver-2"}
|
447 |
|
|
{"Dynamic executable with TLS and versioning (order 3)"
|
448 |
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o"
|
449 |
|
|
"-EB -march=mips1 -32 -KPIC" {}
|
450 |
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-3.d} {objdump -Rsj.got tlsdyn-o32-3.got}}
|
451 |
|
|
"tls-dynamic-o32-ver-3"}
|
452 |
|
|
{"Shared library with TLS and hidden symbols"
|
453 |
|
|
"-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver"
|
454 |
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
455 |
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}}
|
456 |
|
|
"tlslib-o32-hidden.so"}
|
457 |
|
|
{"Shared library with TLS and hidden symbols (2)"
|
458 |
|
|
"-shared -melf32btsmip -T mips-lib.ld"
|
459 |
|
|
"-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s}
|
460 |
|
|
{{objdump -drj.text tls-hidden2.d} {objdump -sj.got tls-hidden2-got.d}}
|
461 |
|
|
"tls-hidden2.so"}
|
462 |
|
|
{"Shared library with TLS and hidden symbols (3)"
|
463 |
|
|
"-shared -melf32btsmip -T tls-hidden3.ld"
|
464 |
|
|
"-EB -march=mips2 -32 -KPIC" {tls-hidden3a.s tls-hidden3b.s}
|
465 |
|
|
{{objdump -dj.text tls-hidden3.d} {objdump -sj.got tls-hidden3.got}
|
466 |
|
|
{readelf --relocs tls-hidden3.r}}
|
467 |
|
|
"tls-hidden3.so"}
|
468 |
|
|
{"Shared library with TLS and hidden symbols (4)"
|
469 |
|
|
"-shared -melf32btsmip -T tls-hidden3.ld"
|
470 |
|
|
"-EB -march=mips2 -32 -KPIC" {tls-hidden4a.s tls-hidden4b.s}
|
471 |
|
|
{{objdump -sj.got tls-hidden4.got} {readelf --relocs tls-hidden4.r}}
|
472 |
|
|
"tls-hidden4.so"}
|
473 |
|
|
}
|
474 |
|
|
|
475 |
|
|
if {[istarget mips*-*-linux*]} {
|
476 |
|
|
run_ld_link_tests $mips_tls_tests
|
477 |
|
|
}
|
478 |
|
|
|
479 |
|
|
set mips16_call_global_test [list \
|
480 |
|
|
[list "Global calls from mips16" \
|
481 |
|
|
"$o32_ld_flags" \
|
482 |
|
|
"$o32_as_flags -mips32r2" \
|
483 |
|
|
{mips16-call-global-1.s mips16-call-global-2.s mips16-call-global-3.s} \
|
484 |
|
|
{{objdump -dr mips16-call-global.d}} \
|
485 |
|
|
"mips16-call-global"]]
|
486 |
|
|
|
487 |
|
|
run_ld_link_tests $mips16_call_global_test
|
488 |
|
|
|
489 |
|
|
set mips16_intermix_test [list \
|
490 |
|
|
[list "Intermixing mips32 and mips16 functions" \
|
491 |
|
|
"$o32_ld_flags" \
|
492 |
|
|
"$o32_as_flags -mips32r2" \
|
493 |
|
|
{mips16-intermix-1.s mips16-intermix-2.s} \
|
494 |
|
|
{{objdump -t mips16-intermix.d}} \
|
495 |
|
|
"mips16-intermix"]]
|
496 |
|
|
|
497 |
|
|
run_ld_link_tests $mips16_intermix_test
|
498 |
|
|
|
499 |
|
|
run_dump_test "mips16-local-stubs-1"
|
500 |
|
|
|
501 |
|
|
run_dump_test "attr-gnu-4-00"
|
502 |
|
|
run_dump_test "attr-gnu-4-01"
|
503 |
|
|
run_dump_test "attr-gnu-4-02"
|
504 |
|
|
run_dump_test "attr-gnu-4-03"
|
505 |
|
|
run_dump_test "attr-gnu-4-04"
|
506 |
|
|
run_dump_test "attr-gnu-4-05"
|
507 |
|
|
run_dump_test "attr-gnu-4-10"
|
508 |
|
|
run_dump_test "attr-gnu-4-11"
|
509 |
|
|
run_dump_test "attr-gnu-4-12"
|
510 |
|
|
run_dump_test "attr-gnu-4-13"
|
511 |
|
|
run_dump_test "attr-gnu-4-14"
|
512 |
|
|
run_dump_test "attr-gnu-4-15"
|
513 |
|
|
run_dump_test "attr-gnu-4-20"
|
514 |
|
|
run_dump_test "attr-gnu-4-21"
|
515 |
|
|
run_dump_test "attr-gnu-4-22"
|
516 |
|
|
run_dump_test "attr-gnu-4-23"
|
517 |
|
|
run_dump_test "attr-gnu-4-24"
|
518 |
|
|
run_dump_test "attr-gnu-4-25"
|
519 |
|
|
run_dump_test "attr-gnu-4-30"
|
520 |
|
|
run_dump_test "attr-gnu-4-31"
|
521 |
|
|
run_dump_test "attr-gnu-4-32"
|
522 |
|
|
run_dump_test "attr-gnu-4-33"
|
523 |
|
|
run_dump_test "attr-gnu-4-34"
|
524 |
|
|
run_dump_test "attr-gnu-4-35"
|
525 |
|
|
run_dump_test "attr-gnu-4-40"
|
526 |
|
|
run_dump_test "attr-gnu-4-41"
|
527 |
|
|
run_dump_test "attr-gnu-4-42"
|
528 |
|
|
run_dump_test "attr-gnu-4-43"
|
529 |
|
|
run_dump_test "attr-gnu-4-44"
|
530 |
|
|
run_dump_test "attr-gnu-4-45"
|
531 |
|
|
run_dump_test "attr-gnu-4-51"
|
532 |
|
|
|
533 |
|
|
if { $linux_gnu } {
|
534 |
|
|
run_ld_link_tests {
|
535 |
|
|
{"GOT and versioning 1"
|
536 |
|
|
"-shared -melf32btsmip --version-script got-vers-1.ver"
|
537 |
|
|
"-EB -mips2 -32" {got-vers-1a.s got-vers-1b.s}
|
538 |
|
|
{{readelf -d got-vers-1.dd}
|
539 |
|
|
{readelf --symbols got-vers-1.sd}
|
540 |
|
|
{readelf --relocs got-vers-1.rd}}
|
541 |
|
|
"got-vers-1.so"}
|
542 |
|
|
}
|
543 |
|
|
}
|
544 |
|
|
|
545 |
|
|
run_dump_test "undefined"
|
546 |
|
|
|
547 |
|
|
# Test the conversion from jr to b
|
548 |
|
|
if { $linux_gnu } {
|
549 |
|
|
run_dump_test "jr-to-b-1"
|
550 |
|
|
run_dump_test "jr-to-b-2"
|
551 |
|
|
}
|