gas:
[binutils/dougsmingw.git] / ld / testsuite / ld-powerpc / powerpc.exp
blobfce966463b3d43e73c8712c7e154c3540ede249e
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 apuinfo2.s}
105 {{readelf -x2 apuinfo.rd}} "apuinfo"}
106 {"TLS32 static exec" "-melf32ppc" "-a32" {tls32.s tlslib32.s}
107 {{objdump -dr tls32.d} {objdump -sj.got tls32.g}
108 {objdump -sj.tdata tls32.t}}
109 "tls32"}
110 {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" {}
111 {} "libtlslib32.so"}
112 {"TLS32 dynamic exec" "-melf32ppc tmpdir/tls32.o tmpdir/libtlslib32.so" "" {}
113 {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
114 {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
115 "tlsexe32"}
116 {"TLS32 shared" "-shared -melf32ppc tmpdir/tls32.o" "" {}
117 {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
118 {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
119 "tls32.so"}
120 {"TLS32 markers" "-melf32ppc" "-a32" {tlsmark32.s tlslib32.s}
121 {{objdump -dr tlsmark32.d}}
122 "tlsmark32"}
123 {"Shared library with global symbol" "-shared -melf32ppc" "-a32" {sdalib.s}
124 {} "sdalib.so"}
125 {"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "-a32" {sdadyn.s}
126 {{objdump -R sdadyn.d}} "sdadyn"}
127 {"relaxing" "-melf32ppc --relax -Ttext=0 --defsym far=0x80001234 --defsym near=0x00004320" "-a32" "relax.s"
128 {{objdump -dr relax.d}}
129 "relax"}
130 {"relocatable relaxing" "-melf32ppc -r --relax" "-a32" "relax.s"
131 {{objdump -dr relaxr.d}}
132 "relax"}
135 set ppc64elftests {
136 {"TLS static exec" "-melf64ppc" "-a64" {tls.s tlslib.s}
137 {{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}}
138 "tls"}
139 {"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
140 {} "libtlslib.so"}
141 {"TLS helper old shared lib" "-shared -melf64ppc" "-a64" {oldtlslib.s}
142 {} "liboldlib.so"}
143 {"TLS dynamic exec" "-melf64ppc tmpdir/tls.o tmpdir/libtlslib.so" "" {}
144 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
145 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
146 "tlsexe"}
147 {"TLS dynamic old" "-melf64ppc tmpdir/tls.o tmpdir/liboldlib.so" "" {}
148 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
149 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
150 "tlsexeold"}
151 {"TLS shared" "-shared -melf64ppc tmpdir/tls.o" "" {}
152 {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
153 {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
154 "tls.so"}
155 {"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "-a64" {tlstoc.s}
156 {{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
157 {objdump -sj.tdata tlstoc.t}}
158 "tlstoc"}
159 {"TLSTOC dynamic exec" "-melf64ppc tmpdir/tlstoc.o tmpdir/libtlslib.so"
160 "" {}
161 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
162 {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
163 "tlsexetoc"}
164 {"TLSTOC dynamic old" "-melf64ppc tmpdir/tlstoc.o tmpdir/liboldlib.so"
165 "" {}
166 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
167 {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
168 "tlsexetocold"}
169 {"TLSTOC shared" "-shared -melf64ppc tmpdir/tlstoc.o" "" {}
170 {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
171 {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
172 "tlstoc.so"}
173 {"TLS markers" "-melf64ppc" "-a64" {tlsmark.s tlslib.s}
174 {{objdump -dr tlsmark.d}}
175 "tlsmark"}
176 {"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
177 {{objdump -dj.data symtocbase.d}} "symtocbase.so"}
181 run_ld_link_tests $ppcelftests
183 if [ supports_ppc64 ] then {
184 run_ld_link_tests $ppc64elftests
185 run_dump_test "relbrlt"
188 run_dump_test "plt1"
190 run_dump_test "attr-gnu-4-00"
191 run_dump_test "attr-gnu-4-01"
192 run_dump_test "attr-gnu-4-02"
193 run_dump_test "attr-gnu-4-03"
194 run_dump_test "attr-gnu-4-10"
195 run_dump_test "attr-gnu-4-11"
196 run_dump_test "attr-gnu-4-12"
197 run_dump_test "attr-gnu-4-13"
198 run_dump_test "attr-gnu-4-14"
199 run_dump_test "attr-gnu-4-20"
200 run_dump_test "attr-gnu-4-21"
201 run_dump_test "attr-gnu-4-22"
202 run_dump_test "attr-gnu-4-23"
203 run_dump_test "attr-gnu-4-24"
204 run_dump_test "attr-gnu-4-31"
205 run_dump_test "attr-gnu-4-32"
206 run_dump_test "attr-gnu-4-33"
207 run_dump_test "attr-gnu-4-34"
208 run_dump_test "attr-gnu-4-41"
210 run_dump_test "attr-gnu-8-11"
211 run_dump_test "attr-gnu-8-23"
212 run_dump_test "attr-gnu-8-31"
214 run_dump_test "attr-gnu-12-11"
215 run_dump_test "attr-gnu-12-21"