ld/
[deliverable/binutils-gdb.git] / ld / testsuite / ld-powerpc / powerpc.exp
1 # Expect script for ld-powerpc tests
2 # Copyright 2002, 2003, 2005, 2006 Free Software Foundation
3 #
4 # This file is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18
19 if { ![istarget "powerpc*-*-*"] } {
20 return
21 }
22
23 if {[istarget "*-*-vxworks"]} {
24 set ppcvxtests {
25 {"VxWorks shared library test 1 (default script)" "-shared"
26 "-mregnames" {vxworks1-lib.s}
27 {{readelf --segments vxworks1-lib.sd}}
28 "libvxworks1.so"}
29 {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
30 "-mregnames" {vxworks1-lib.s}
31 {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
32 {readelf --symbols vxworks1-lib.nd}}
33 "libvxworks1.so"}
34 {"VxWorks executable test 1 (dynamic)" \
35 "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
36 "-mregnames" {vxworks1.s}
37 {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
38 "vxworks1"}
39 {"VxWorks executable test 2 (dynamic)" \
40 "-Tvxworks1.ld -q --force-dynamic"
41 "-mregnames" {vxworks2.s}
42 {{readelf --segments vxworks2.sd}}
43 "vxworks2"}
44 {"VxWorks executable test 2 (static)"
45 "-Tvxworks1.ld"
46 "-mregnames" {vxworks2.s}
47 {{readelf --segments vxworks2-static.sd}}
48 "vxworks2"}
49 }
50 run_ld_link_tests $ppcvxtests
51 run_dump_test "vxworks1-static"
52 return
53 }
54
55 # powerpc ELF only at the moment.
56
57 if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
58 || [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
59 || [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
60 || [istarget "*-*-beos*"] } {
61 return
62 }
63
64 proc supports_ppc64 { } {
65 global ld
66
67 catch "exec $ld --help | grep emulations" tmp
68 if [ string match "*elf64ppc*" $tmp ] then {
69 return 1
70 } else {
71 return 0
72 }
73 }
74
75 # List contains test-items with 3 items followed by 2 lists:
76 # 0:name 1:ld options 2:assembler options
77 # 3:filenames of assembler files 4: action and options. 5: name of output file
78
79 # Actions:
80 # objdump: Apply objdump options on result. Compare with regex (last arg).
81 # nm: Apply nm options on result. Compare with regex (last arg).
82 # readelf: Apply readelf options on result. Compare with regex (last arg).
83
84 set ppcelftests {
85 {"Reloc section order" "-melf32ppc -shared -z nocombreloc" "-a32" {reloc.s}
86 {{objdump -hw reloc.d}} "reloc.so"}
87 {"APUinfo section processing" "-melf32ppc"
88 "-a32 -me500" {apuinfo1.s apuinfo2.s}
89 {{readelf -x2 apuinfo.rd}} "apuinfo"}
90 {"TLS32 static exec" "-melf32ppc" "-a32" {tls32.s tlslib32.s}
91 {{objdump -dr tls32.d} {objdump -sj.got tls32.g}
92 {objdump -sj.tdata tls32.t}}
93 "tls32"}
94 {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" {}
95 {} "libtlslib32.so"}
96 {"TLS32 dynamic exec" "-melf32ppc tmpdir/tls32.o tmpdir/libtlslib32.so" "" {}
97 {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
98 {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
99 "tlsexe32"}
100 {"TLS32 shared" "-shared -melf32ppc tmpdir/tls32.o" "" {}
101 {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
102 {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
103 "tls32.so"}
104 {"Shared library with global symbol" "-shared -melf32ppc" "-a32" {sdalib.s}
105 {} "sdalib.so"}
106 {"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "-a32" {sdadyn.s}
107 {{objdump -R sdadyn.d}} "sdadyn"}
108 }
109
110 set ppc64elftests {
111 {"TLS static exec" "-melf64ppc" "-a64" {tls.s tlslib.s}
112 {{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}}
113 "tls"}
114 {"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
115 {} "libtlslib.so"}
116 {"TLS dynamic exec" "-melf64ppc tmpdir/tls.o tmpdir/libtlslib.so" "" {}
117 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
118 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
119 "tlsexe"}
120 {"TLS shared" "-shared -melf64ppc tmpdir/tls.o" "" {}
121 {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
122 {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
123 "tls.so"}
124 {"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "-a64" {tlstoc.s}
125 {{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
126 {objdump -sj.tdata tlstoc.t}}
127 "tlstoc"}
128 {"TLSTOC dynamic exec" "-melf64ppc tmpdir/tlstoc.o tmpdir/libtlslib.so"
129 "" {}
130 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
131 {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
132 "tlsexetoc"}
133 {"TLSTOC shared" "-shared -melf64ppc tmpdir/tlstoc.o" "" {}
134 {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
135 {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
136 "tlstoc.so"}
137 {"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
138 {{objdump -dj.data symtocbase.d}} "symtocbase.so"}
139 }
140
141
142 run_ld_link_tests $ppcelftests
143
144 if [ supports_ppc64 ] then {
145 run_ld_link_tests $ppc64elftests
146 run_dump_test "relbrlt"
147 }
148
149 run_dump_test "plt1"
This page took 0.033004 seconds and 4 git commands to generate.