1 |
95 |
khays |
# Expect script for ld-powerpc tests
|
2 |
|
|
# Copyright 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
3 |
|
|
# Free Software Foundation
|
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 "powerpc*-*-*"] } {
|
24 |
|
|
return
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
if {[istarget "*-*-vxworks"]} {
|
28 |
|
|
set ppcvxtests {
|
29 |
|
|
{"VxWorks shared library test 1 (default script)" "-shared"
|
30 |
|
|
"-mregnames" {vxworks1-lib.s}
|
31 |
|
|
{{readelf --segments vxworks1-lib.sd}}
|
32 |
|
|
"libvxworks1.so"}
|
33 |
|
|
{"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
|
34 |
|
|
"-mregnames" {vxworks1-lib.s}
|
35 |
|
|
{{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
|
36 |
|
|
{readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
|
37 |
|
|
"libvxworks1.so"}
|
38 |
|
|
{"VxWorks executable test 1 (dynamic)" \
|
39 |
|
|
"tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
|
40 |
|
|
"-mregnames" {vxworks1.s}
|
41 |
|
|
{{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
|
42 |
|
|
"vxworks1"}
|
43 |
|
|
{"VxWorks executable test 2 (dynamic)" \
|
44 |
|
|
"-Tvxworks1.ld -q --force-dynamic"
|
45 |
|
|
"-mregnames" {vxworks2.s}
|
46 |
|
|
{{readelf --segments vxworks2.sd}}
|
47 |
|
|
"vxworks2"}
|
48 |
|
|
{"VxWorks executable test 2 (static)"
|
49 |
|
|
"-Tvxworks1.ld"
|
50 |
|
|
"-mregnames" {vxworks2.s}
|
51 |
|
|
{{readelf --segments vxworks2-static.sd}}
|
52 |
|
|
"vxworks2"}
|
53 |
|
|
{"VxWorks relax test"
|
54 |
|
|
"-Tvxworks1.ld --relax -q"
|
55 |
|
|
"-mregnames" {vxworks-relax.s}
|
56 |
|
|
{{readelf --relocs vxworks-relax.rd}}
|
57 |
|
|
"vxworks-relax"}
|
58 |
|
|
{"VxWorks relocatable relax test"
|
59 |
|
|
"-Tvxworks1.ld -r --relax -q"
|
60 |
|
|
"-mregnames" {vxworks-relax-2.s}
|
61 |
|
|
{{readelf --relocs vxworks-relax-2.rd}}
|
62 |
|
|
"vxworks-relax-2"}
|
63 |
|
|
}
|
64 |
|
|
run_ld_link_tests $ppcvxtests
|
65 |
|
|
run_dump_test "vxworks1-static"
|
66 |
|
|
return
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
# powerpc ELF only at the moment. Disable for nto too, even though it
|
70 |
|
|
# is ELF, because we pass -melf32ppc to ld and powerpc-nto-ld wants
|
71 |
|
|
# -melf32ppcnto.
|
72 |
|
|
|
73 |
|
|
if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
|
74 |
|
|
|| [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
|
75 |
|
|
|| [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
|
76 |
|
|
|| [istarget "*-*-beos*"] || [istarget "*-*-lynxos*"]
|
77 |
|
|
|| [istarget "*-*-nto*"] } {
|
78 |
|
|
return
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
proc supports_ppc64 { } {
|
82 |
|
|
global ld
|
83 |
|
|
|
84 |
|
|
catch "exec $ld --help | grep emulations" tmp
|
85 |
|
|
if [ string match "*elf64ppc*" $tmp ] then {
|
86 |
|
|
return 1
|
87 |
|
|
} else {
|
88 |
|
|
return 0
|
89 |
|
|
}
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
# List contains test-items with 3 items followed by 2 lists:
|
93 |
|
|
# 0:name 1:ld options 2:assembler options
|
94 |
|
|
# 3:filenames of assembler files 4: action and options. 5: name of output file
|
95 |
|
|
|
96 |
|
|
# Actions:
|
97 |
|
|
# objdump: Apply objdump options on result. Compare with regex (last arg).
|
98 |
|
|
# nm: Apply nm options on result. Compare with regex (last arg).
|
99 |
|
|
# readelf: Apply readelf options on result. Compare with regex (last arg).
|
100 |
|
|
|
101 |
|
|
set ppcelftests {
|
102 |
|
|
{"Reloc section order" "-melf32ppc -shared -z nocombreloc" "-a32" {reloc.s}
|
103 |
|
|
{{objdump -hw reloc.d}} "reloc.so"}
|
104 |
|
|
{"APUinfo section processing" "-melf32ppc"
|
105 |
|
|
"-a32 -me500" {apuinfo1.s apuinfo-nul.s apuinfo2.s}
|
106 |
|
|
{{readelf -x2 apuinfo.rd}} "apuinfo"}
|
107 |
|
|
{"APUinfo NULL section processing" "-melf32ppc"
|
108 |
|
|
"-a32 -me500" {apuinfo-nul1.s apuinfo-nul.s}
|
109 |
|
|
{{readelf -x2 apuinfo-nul.rd}} "apuinfo"}
|
110 |
|
|
{"TLS32 static exec" "-melf32ppc" "-a32" {tls32.s tlslib32.s}
|
111 |
|
|
{{objdump -dr tls32.d} {objdump -sj.got tls32.g}
|
112 |
|
|
{objdump -sj.tdata tls32.t}}
|
113 |
|
|
"tls32"}
|
114 |
|
|
{"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" {}
|
115 |
|
|
{} "libtlslib32.so"}
|
116 |
157 |
khays |
{"TLS32 dynamic exec" "-melf32ppc --no-ld-generated-unwind-info tmpdir/tls32.o tmpdir/libtlslib32.so" "" {}
|
117 |
95 |
khays |
{{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
|
118 |
|
|
{objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
|
119 |
|
|
"tlsexe32"}
|
120 |
157 |
khays |
{"TLS32 shared" "-shared -melf32ppc --no-ld-generated-unwind-info tmpdir/tls32.o" "" {}
|
121 |
95 |
khays |
{{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
|
122 |
|
|
{objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
|
123 |
|
|
"tls32.so"}
|
124 |
|
|
{"TLS32 markers" "-melf32ppc" "-a32" {tlsmark32.s tlslib32.s}
|
125 |
|
|
{{objdump -dr tlsmark32.d}}
|
126 |
|
|
"tlsmark32"}
|
127 |
|
|
{"TLS32 opt 1" "-melf32ppc" "-a32" {tlsopt1_32.s tlslib32.s}
|
128 |
|
|
{{objdump -dr tlsopt1_32.d}}
|
129 |
|
|
"tlsopt1_32"}
|
130 |
|
|
{"TLS32 opt 2" "-melf32ppc" "-a32" {tlsopt2_32.s tlslib32.s}
|
131 |
|
|
{{objdump -dr tlsopt2_32.d}}
|
132 |
|
|
"tlsopt2_32"}
|
133 |
|
|
{"TLS32 opt 3" "-melf32ppc" "-a32" {tlsopt3_32.s tlslib32.s}
|
134 |
|
|
{{objdump -dr tlsopt3_32.d}}
|
135 |
|
|
"tlsopt3_32"}
|
136 |
|
|
{"TLS32 opt 4" "-melf32ppc" "-a32" {tlsopt4_32.s tlslib32.s}
|
137 |
|
|
{{objdump -dr tlsopt4_32.d}}
|
138 |
|
|
"tlsopt4_32"}
|
139 |
|
|
{"Shared library with global symbol" "-shared -melf32ppc" "-a32" {sdalib.s}
|
140 |
|
|
{} "sdalib.so"}
|
141 |
|
|
{"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "-a32" {sdadyn.s}
|
142 |
|
|
{{objdump -R sdadyn.d}} "sdadyn"}
|
143 |
|
|
{"relaxing" "-melf32ppc --relax -Ttext=0 --defsym far=0x80001234 --defsym near=0x00004320" "-a32" "relax.s"
|
144 |
|
|
{{objdump -dr relax.d}}
|
145 |
|
|
"relax"}
|
146 |
|
|
{"relocatable relaxing" "-melf32ppc -r --relax" "-a32" "relax.s"
|
147 |
|
|
{{objdump -dr relaxr.d}}
|
148 |
|
|
"relax"}
|
149 |
|
|
}
|
150 |
|
|
|
151 |
|
|
set ppc64elftests {
|
152 |
|
|
{"TLS static exec" "-melf64ppc" "-a64" {tls.s tlslib.s}
|
153 |
|
|
{{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}}
|
154 |
|
|
"tls"}
|
155 |
|
|
{"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
|
156 |
|
|
{} "libtlslib.so"}
|
157 |
|
|
{"TLS helper old shared lib" "-shared -melf64ppc" "-a64" {oldtlslib.s}
|
158 |
|
|
{} "liboldlib.so"}
|
159 |
157 |
khays |
{"TLS dynamic exec" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o tmpdir/libtlslib.so" "" {}
|
160 |
95 |
khays |
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
|
161 |
|
|
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
|
162 |
|
|
"tlsexe"}
|
163 |
157 |
khays |
{"TLS dynamic old" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o tmpdir/liboldlib.so" "" {}
|
164 |
95 |
khays |
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
|
165 |
|
|
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
|
166 |
|
|
"tlsexeold"}
|
167 |
157 |
khays |
{"TLS shared" "-shared -melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o" "" {}
|
168 |
95 |
khays |
{{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
|
169 |
|
|
{objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
|
170 |
|
|
"tls.so"}
|
171 |
|
|
{"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "-a64" {tlstoc.s}
|
172 |
|
|
{{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
|
173 |
|
|
{objdump -sj.tdata tlstoc.t}}
|
174 |
|
|
"tlstoc"}
|
175 |
157 |
khays |
{"TLSTOC dynamic exec" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o tmpdir/libtlslib.so"
|
176 |
95 |
khays |
"" {}
|
177 |
|
|
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
|
178 |
|
|
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
|
179 |
|
|
"tlsexetoc"}
|
180 |
157 |
khays |
{"TLSTOC dynamic old" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o tmpdir/liboldlib.so"
|
181 |
95 |
khays |
"" {}
|
182 |
|
|
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
|
183 |
|
|
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
|
184 |
|
|
"tlsexetocold"}
|
185 |
157 |
khays |
{"TLSTOC shared" "-shared -melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o" "" {}
|
186 |
95 |
khays |
{{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
|
187 |
|
|
{objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
|
188 |
|
|
"tlstoc.so"}
|
189 |
|
|
{"TLS markers" "-melf64ppc" "-a64" {tlsmark.s tlslib.s}
|
190 |
|
|
{{objdump -dr tlsmark.d}}
|
191 |
|
|
"tlsmark"}
|
192 |
|
|
{"TLS opt 1" "-melf64ppc" "-a64" {tlsopt1.s tlslib.s}
|
193 |
|
|
{{objdump -dr tlsopt1.d}}
|
194 |
|
|
"tlsopt1"}
|
195 |
|
|
{"TLS opt 2" "-melf64ppc" "-a64" {tlsopt2.s tlslib.s}
|
196 |
|
|
{{objdump -dr tlsopt2.d}}
|
197 |
|
|
"tlsopt2"}
|
198 |
|
|
{"TLS opt 3" "-melf64ppc" "-a64" {tlsopt3.s tlslib.s}
|
199 |
|
|
{{objdump -dr tlsopt3.d}}
|
200 |
|
|
"tlsopt3"}
|
201 |
|
|
{"TLS opt 4" "-melf64ppc" "-a64" {tlsopt4.s tlslib.s}
|
202 |
|
|
{{objdump -dr tlsopt4.d}}
|
203 |
|
|
"tlsopt4"}
|
204 |
|
|
{"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
|
205 |
|
|
{{objdump -dj.data symtocbase.d}} "symtocbase.so"}
|
206 |
|
|
{"TOC opt" "-melf64ppc" "-a64" {tocopt.s}
|
207 |
163 |
khays |
{{ld tocopt.out} {objdump -s tocopt.d}} "tocopt"}
|
208 |
157 |
khays |
{"TOC opt2" "-melf64ppc --defsym x=2" "-a64" {tocopt2.s}
|
209 |
|
|
{{ld tocopt2.out} {objdump -s tocopt2.d}} "tocopt2"}
|
210 |
|
|
{"TOC opt3" "-melf64ppc -no-keep-memory --defsym x=2" "-a64" {tocopt3.s}
|
211 |
|
|
{{objdump -s tocopt3.d}} "tocopt3"}
|
212 |
|
|
{"TOC opt4" "-melf64ppc -no-keep-memory --defsym x=2" "-a64"
|
213 |
|
|
{tocopt4a.s tocopt4b.s} {{objdump -s tocopt4.d}} "tocopt4"}
|
214 |
163 |
khays |
{"TOC opt5" "-melf64ppc" "-a64" {tocopt5.s}
|
215 |
|
|
{{objdump -s tocopt5.d}} "tocopt5"}
|
216 |
95 |
khays |
}
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
run_ld_link_tests $ppcelftests
|
220 |
|
|
|
221 |
|
|
if [ supports_ppc64 ] then {
|
222 |
|
|
run_ld_link_tests $ppc64elftests
|
223 |
|
|
run_dump_test "relbrlt"
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
run_dump_test "plt1"
|
227 |
|
|
|
228 |
|
|
run_dump_test "attr-gnu-4-00"
|
229 |
|
|
run_dump_test "attr-gnu-4-01"
|
230 |
|
|
run_dump_test "attr-gnu-4-02"
|
231 |
|
|
run_dump_test "attr-gnu-4-03"
|
232 |
|
|
run_dump_test "attr-gnu-4-10"
|
233 |
|
|
run_dump_test "attr-gnu-4-11"
|
234 |
|
|
run_dump_test "attr-gnu-4-12"
|
235 |
|
|
run_dump_test "attr-gnu-4-13"
|
236 |
|
|
run_dump_test "attr-gnu-4-14"
|
237 |
|
|
run_dump_test "attr-gnu-4-20"
|
238 |
|
|
run_dump_test "attr-gnu-4-21"
|
239 |
|
|
run_dump_test "attr-gnu-4-22"
|
240 |
|
|
run_dump_test "attr-gnu-4-23"
|
241 |
|
|
run_dump_test "attr-gnu-4-24"
|
242 |
|
|
run_dump_test "attr-gnu-4-31"
|
243 |
|
|
run_dump_test "attr-gnu-4-32"
|
244 |
|
|
run_dump_test "attr-gnu-4-33"
|
245 |
|
|
run_dump_test "attr-gnu-4-34"
|
246 |
|
|
run_dump_test "attr-gnu-4-41"
|
247 |
|
|
|
248 |
|
|
run_dump_test "attr-gnu-8-11"
|
249 |
|
|
run_dump_test "attr-gnu-8-23"
|
250 |
|
|
run_dump_test "attr-gnu-8-31"
|
251 |
|
|
|
252 |
|
|
run_dump_test "attr-gnu-12-11"
|
253 |
|
|
run_dump_test "attr-gnu-12-21"
|