Merge remote branch 'origin/master'
[binutils/dougsmingw.git] / ld / testsuite / ld-powerpc / powerpc.exp
blob9d0207f1c0c68b7497357785800f6cea14af6a33
1 # Expect script for ld-powerpc tests
2 # Copyright 2002, 2003, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
4 # This file is part of the GNU Binutils.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 # MA 02110-1301, USA.
22 if { ![istarget "powerpc*-*-*"] } {
23 return
26 if {[istarget "*-*-vxworks"]} {
27 set ppcvxtests {
28 {"VxWorks shared library test 1 (default script)" "-shared"
29 "-mregnames" {vxworks1-lib.s}
30 {{readelf --segments vxworks1-lib.sd}}
31 "libvxworks1.so"}
32 {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
33 "-mregnames" {vxworks1-lib.s}
34 {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
35 {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
36 "libvxworks1.so"}
37 {"VxWorks executable test 1 (dynamic)" \
38 "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
39 "-mregnames" {vxworks1.s}
40 {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
41 "vxworks1"}
42 {"VxWorks executable test 2 (dynamic)" \
43 "-Tvxworks1.ld -q --force-dynamic"
44 "-mregnames" {vxworks2.s}
45 {{readelf --segments vxworks2.sd}}
46 "vxworks2"}
47 {"VxWorks executable test 2 (static)"
48 "-Tvxworks1.ld"
49 "-mregnames" {vxworks2.s}
50 {{readelf --segments vxworks2-static.sd}}
51 "vxworks2"}
52 {"VxWorks relax test"
53 "-Tvxworks1.ld --relax -q"
54 "-mregnames" {vxworks-relax.s}
55 {{readelf --relocs vxworks-relax.rd}}
56 "vxworks-relax"}
57 {"VxWorks relocatable relax test"
58 "-Tvxworks1.ld -r --relax -q"
59 "-mregnames" {vxworks-relax-2.s}
60 {{readelf --relocs vxworks-relax-2.rd}}
61 "vxworks-relax-2"}
63 run_ld_link_tests $ppcvxtests
64 run_dump_test "vxworks1-static"
65 return
68 # powerpc ELF only at the moment. Disable for nto too, even though it
69 # is ELF, because we pass -melf32ppc to ld and powerpc-nto-ld wants
70 # -melf32ppcnto.
72 if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
73 || [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
74 || [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
75 || [istarget "*-*-beos*"] || [istarget "*-*-lynxos*"]
76 || [istarget "*-*-nto*"] } {
77 return
80 proc supports_ppc64 { } {
81 global ld
83 catch "exec $ld --help | grep emulations" tmp
84 if [ string match "*elf64ppc*" $tmp ] then {
85 return 1
86 } else {
87 return 0
91 # List contains test-items with 3 items followed by 2 lists:
92 # 0:name 1:ld options 2:assembler options
93 # 3:filenames of assembler files 4: action and options. 5: name of output file
95 # Actions:
96 # objdump: Apply objdump options on result. Compare with regex (last arg).
97 # nm: Apply nm options on result. Compare with regex (last arg).
98 # readelf: Apply readelf options on result. Compare with regex (last arg).
100 set ppcelftests {
101 {"Reloc section order" "-melf32ppc -shared -z nocombreloc" "-a32" {reloc.s}
102 {{objdump -hw reloc.d}} "reloc.so"}
103 {"APUinfo section processing" "-melf32ppc"
104 "-a32 -me500" {apuinfo1.s apuinfo-nul.s apuinfo2.s}
105 {{readelf -x2 apuinfo.rd}} "apuinfo"}
106 {"APUinfo NULL section processing" "-melf32ppc"
107 "-a32 -me500" {apuinfo-nul1.s apuinfo-nul.s}
108 {{readelf -x2 apuinfo-nul.rd}} "apuinfo"}
109 {"TLS32 static exec" "-melf32ppc" "-a32" {tls32.s tlslib32.s}
110 {{objdump -dr tls32.d} {objdump -sj.got tls32.g}
111 {objdump -sj.tdata tls32.t}}
112 "tls32"}
113 {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" {}
114 {} "libtlslib32.so"}
115 {"TLS32 dynamic exec" "-melf32ppc tmpdir/tls32.o tmpdir/libtlslib32.so" "" {}
116 {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
117 {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
118 "tlsexe32"}
119 {"TLS32 shared" "-shared -melf32ppc tmpdir/tls32.o" "" {}
120 {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
121 {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
122 "tls32.so"}
123 {"TLS32 markers" "-melf32ppc" "-a32" {tlsmark32.s tlslib32.s}
124 {{objdump -dr tlsmark32.d}}
125 "tlsmark32"}
126 {"Shared library with global symbol" "-shared -melf32ppc" "-a32" {sdalib.s}
127 {} "sdalib.so"}
128 {"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "-a32" {sdadyn.s}
129 {{objdump -R sdadyn.d}} "sdadyn"}
130 {"relaxing" "-melf32ppc --relax -Ttext=0 --defsym far=0x80001234 --defsym near=0x00004320" "-a32" "relax.s"
131 {{objdump -dr relax.d}}
132 "relax"}
133 {"relocatable relaxing" "-melf32ppc -r --relax" "-a32" "relax.s"
134 {{objdump -dr relaxr.d}}
135 "relax"}
138 set ppc64elftests {
139 {"TLS static exec" "-melf64ppc" "-a64" {tls.s tlslib.s}
140 {{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}}
141 "tls"}
142 {"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
143 {} "libtlslib.so"}
144 {"TLS helper old shared lib" "-shared -melf64ppc" "-a64" {oldtlslib.s}
145 {} "liboldlib.so"}
146 {"TLS dynamic exec" "-melf64ppc tmpdir/tls.o tmpdir/libtlslib.so" "" {}
147 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
148 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
149 "tlsexe"}
150 {"TLS dynamic old" "-melf64ppc tmpdir/tls.o tmpdir/liboldlib.so" "" {}
151 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
152 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
153 "tlsexeold"}
154 {"TLS shared" "-shared -melf64ppc tmpdir/tls.o" "" {}
155 {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
156 {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
157 "tls.so"}
158 {"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "-a64" {tlstoc.s}
159 {{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
160 {objdump -sj.tdata tlstoc.t}}
161 "tlstoc"}
162 {"TLSTOC dynamic exec" "-melf64ppc tmpdir/tlstoc.o tmpdir/libtlslib.so"
163 "" {}
164 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
165 {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
166 "tlsexetoc"}
167 {"TLSTOC dynamic old" "-melf64ppc tmpdir/tlstoc.o tmpdir/liboldlib.so"
168 "" {}
169 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
170 {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
171 "tlsexetocold"}
172 {"TLSTOC shared" "-shared -melf64ppc tmpdir/tlstoc.o" "" {}
173 {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
174 {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
175 "tlstoc.so"}
176 {"TLS markers" "-melf64ppc" "-a64" {tlsmark.s tlslib.s}
177 {{objdump -dr tlsmark.d}}
178 "tlsmark"}
179 {"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
180 {{objdump -dj.data symtocbase.d}} "symtocbase.so"}
184 run_ld_link_tests $ppcelftests
186 if [ supports_ppc64 ] then {
187 run_ld_link_tests $ppc64elftests
188 run_dump_test "relbrlt"
191 run_dump_test "plt1"
193 run_dump_test "attr-gnu-4-00"
194 run_dump_test "attr-gnu-4-01"
195 run_dump_test "attr-gnu-4-02"
196 run_dump_test "attr-gnu-4-03"
197 run_dump_test "attr-gnu-4-10"
198 run_dump_test "attr-gnu-4-11"
199 run_dump_test "attr-gnu-4-12"
200 run_dump_test "attr-gnu-4-13"
201 run_dump_test "attr-gnu-4-14"
202 run_dump_test "attr-gnu-4-20"
203 run_dump_test "attr-gnu-4-21"
204 run_dump_test "attr-gnu-4-22"
205 run_dump_test "attr-gnu-4-23"
206 run_dump_test "attr-gnu-4-24"
207 run_dump_test "attr-gnu-4-31"
208 run_dump_test "attr-gnu-4-32"
209 run_dump_test "attr-gnu-4-33"
210 run_dump_test "attr-gnu-4-34"
211 run_dump_test "attr-gnu-4-41"
213 run_dump_test "attr-gnu-8-11"
214 run_dump_test "attr-gnu-8-23"
215 run_dump_test "attr-gnu-8-31"
217 run_dump_test "attr-gnu-12-11"
218 run_dump_test "attr-gnu-12-21"