1 # Expect script for ld-powerpc tests
2 # Copyright 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3 # Free Software Foundation
5 # This file is part of the GNU Binutils.
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.
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.
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,
23 if { ![istarget "powerpc*-*-*"] } {
27 if {[istarget "*-*-vxworks"]} {
29 {"VxWorks shared library test 1 (default script)" "-shared"
30 "-mregnames" {vxworks1-lib.s}
31 {{readelf --segments vxworks1-lib.sd}}
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}}
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}}
43 {"VxWorks executable test 2 (dynamic)" \
44 "-Tvxworks1.ld -q --force-dynamic"
45 "-mregnames" {vxworks2.s}
46 {{readelf --segments vxworks2.sd}}
48 {"VxWorks executable test 2 (static)"
50 "-mregnames" {vxworks2.s}
51 {{readelf --segments vxworks2-static.sd}}
54 "-Tvxworks1.ld --relax -q"
55 "-mregnames" {vxworks-relax.s}
56 {{readelf --relocs vxworks-relax.rd}}
58 {"VxWorks relocatable relax test"
59 "-Tvxworks1.ld -r --relax -q"
60 "-mregnames" {vxworks-relax-2.s}
61 {{readelf --relocs vxworks-relax-2.rd}}
64 run_ld_link_tests $ppcvxtests
65 run_dump_test "vxworks1-static"
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
73 if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
74 || [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
75 || [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
76 || [istarget "*-*-beos*"] || [istarget "*-*-lynxos*"]
77 || [istarget "*-*-nto*"] } {
81 proc supports_ppc64 { } {
84 catch "exec $ld --help | grep emulations" tmp
85 if [ string match "*elf64ppc*" $tmp ] then {
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
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).
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}}
114 {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" {}
116 {"TLS32 dynamic exec" "-melf32ppc --no-ld-generated-unwind-info tmpdir/tls32.o tmpdir/libtlslib32.so" "" {}
117 {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
118 {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
120 {"TLS32 shared" "-shared -melf32ppc --no-ld-generated-unwind-info tmpdir/tls32.o" "" {}
121 {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
122 {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
124 {"TLS32 markers" "-melf32ppc" "-a32" {tlsmark32.s tlslib32.s}
125 {{objdump -dr tlsmark32.d}}
127 {"TLS32 opt 1" "-melf32ppc" "-a32" {tlsopt1_32.s tlslib32.s}
128 {{objdump -dr tlsopt1_32.d}}
130 {"TLS32 opt 2" "-melf32ppc" "-a32" {tlsopt2_32.s tlslib32.s}
131 {{objdump -dr tlsopt2_32.d}}
133 {"TLS32 opt 3" "-melf32ppc" "-a32" {tlsopt3_32.s tlslib32.s}
134 {{objdump -dr tlsopt3_32.d}}
136 {"TLS32 opt 4" "-melf32ppc" "-a32" {tlsopt4_32.s tlslib32.s}
137 {{objdump -dr tlsopt4_32.d}}
139 {"Shared library with global symbol" "-shared -melf32ppc" "-a32" {sdalib.s}
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}}
146 {"relocatable relaxing" "-melf32ppc -r --relax" "-a32" "relax.s"
147 {{objdump -dr relaxr.d}}
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}}
155 {"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
157 {"TLS helper old shared lib" "-shared -melf64ppc" "-a64" {oldtlslib.s}
159 {"TLS dynamic exec" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o tmpdir/libtlslib.so" "" {}
160 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
161 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
163 {"TLS dynamic old" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o tmpdir/liboldlib.so" "" {}
164 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
165 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
167 {"TLS shared" "-shared -melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o" "" {}
168 {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
169 {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
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}}
175 {"TLSTOC dynamic exec" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o tmpdir/libtlslib.so"
177 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
178 {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
180 {"TLSTOC dynamic old" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o tmpdir/liboldlib.so"
182 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
183 {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
185 {"TLSTOC shared" "-shared -melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o" "" {}
186 {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
187 {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
189 {"TLS markers" "-melf64ppc" "-a64" {tlsmark.s tlslib.s}
190 {{objdump -dr tlsmark.d}}
192 {"TLS opt 1" "-melf64ppc" "-a64" {tlsopt1.s tlslib.s}
193 {{objdump -dr tlsopt1.d}}
195 {"TLS opt 2" "-melf64ppc" "-a64" {tlsopt2.s tlslib.s}
196 {{objdump -dr tlsopt2.d}}
198 {"TLS opt 3" "-melf64ppc" "-a64" {tlsopt3.s tlslib.s}
199 {{objdump -dr tlsopt3.d}}
201 {"TLS opt 4" "-melf64ppc" "-a64" {tlsopt4.s tlslib.s}
202 {{objdump -dr tlsopt4.d}}
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 {{objdump -s tocopt.d}} "tocopt"}
208 {"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"}
217 run_ld_link_tests $ppcelftests
219 if [ supports_ppc64 ] then {
220 run_ld_link_tests $ppc64elftests
221 run_dump_test "relbrlt"
226 run_dump_test "attr-gnu-4-00"
227 run_dump_test "attr-gnu-4-01"
228 run_dump_test "attr-gnu-4-02"
229 run_dump_test "attr-gnu-4-03"
230 run_dump_test "attr-gnu-4-10"
231 run_dump_test "attr-gnu-4-11"
232 run_dump_test "attr-gnu-4-12"
233 run_dump_test "attr-gnu-4-13"
234 run_dump_test "attr-gnu-4-14"
235 run_dump_test "attr-gnu-4-20"
236 run_dump_test "attr-gnu-4-21"
237 run_dump_test "attr-gnu-4-22"
238 run_dump_test "attr-gnu-4-23"
239 run_dump_test "attr-gnu-4-24"
240 run_dump_test "attr-gnu-4-31"
241 run_dump_test "attr-gnu-4-32"
242 run_dump_test "attr-gnu-4-33"
243 run_dump_test "attr-gnu-4-34"
244 run_dump_test "attr-gnu-4-41"
246 run_dump_test "attr-gnu-8-11"
247 run_dump_test "attr-gnu-8-23"
248 run_dump_test "attr-gnu-8-31"
250 run_dump_test "attr-gnu-12-11"
251 run_dump_test "attr-gnu-12-21"