* elf32-m32c.c (m32c_offset_for_reloc): Fix local symbol
[binutils.git] / ld / testsuite / ld-powerpc / powerpc.exp
blobdb7fe598e72b7c40dcda8399bba8c178270cfe24
1 # Expect script for ld-powerpc tests
2 # Copyright 2002, 2003, 2005 Free Software Foundation
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.
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.
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.
19 if { ![istarget "powerpc*-*-*"] } {
20 return
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 dynamic executable test 1" \
35 "tmpdir/libvxworks1.so -Tvxworks1.ld -q" "-mregnames" {vxworks1.s}
36 {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
37 "vxworks1"}
39 run_ld_link_tests $ppcvxtests
40 return
43 # powerpc ELF only at the moment.
45 if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
46 || [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
47 || [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
48 || [istarget "*-*-beos*"] } {
49 return
52 proc supports_ppc64 { } {
53 global ld
55 catch "exec $ld --help | grep emulations" tmp
56 if [ string match "*elf64ppc*" $tmp ] then {
57 return 1
58 } else {
59 return 0
63 # List contains test-items with 3 items followed by 2 lists:
64 # 0:name 1:ld options 2:assembler options
65 # 3:filenames of assembler files 4: action and options. 5: name of output file
67 # Actions:
68 # objdump: Apply objdump options on result. Compare with regex (last arg).
69 # nm: Apply nm options on result. Compare with regex (last arg).
70 # readelf: Apply readelf options on result. Compare with regex (last arg).
72 set ppcelftests {
73 {"Reloc section order" "-melf32ppc -shared -z nocombreloc" "-a32" {reloc.s}
74 {{objdump -hw reloc.d}} "reloc.so"}
75 {"APUinfo section processing" "-melf32ppc"
76 "-a32 -me500" {apuinfo1.s apuinfo2.s}
77 {{readelf -x2 apuinfo.rd}} "apuinfo"}
78 {"TLS32 static exec" "-melf32ppc" "-a32" {tls32.s tlslib32.s}
79 {{objdump -dr tls32.d} {objdump -sj.got tls32.g}
80 {objdump -sj.tdata tls32.t}}
81 "tls32"}
82 {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" {}
83 {} "libtlslib32.so"}
84 {"TLS32 dynamic exec" "-melf32ppc tmpdir/tls32.o tmpdir/libtlslib32.so" "" {}
85 {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
86 {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
87 "tlsexe32"}
88 {"TLS32 shared" "-shared -melf32ppc tmpdir/tls32.o" "" {}
89 {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
90 {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
91 "tls32.so"}
92 {"Shared library with global symbol" "-shared -melf32ppc" "-a32" {sdalib.s}
93 {} "sdalib.so"}
94 {"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "-a32" {sdadyn.s}
95 {{objdump -R sdadyn.d}} "sdadyn"}
98 set ppc64elftests {
99 {"TLS static exec" "-melf64ppc" "-a64" {tls.s tlslib.s}
100 {{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}}
101 "tls"}
102 {"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
103 {} "libtlslib.so"}
104 {"TLS dynamic exec" "-melf64ppc tmpdir/tls.o tmpdir/libtlslib.so" "" {}
105 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
106 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
107 "tlsexe"}
108 {"TLS shared" "-shared -melf64ppc tmpdir/tls.o" "" {}
109 {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
110 {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
111 "tls.so"}
112 {"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "-a64" {tlstoc.s}
113 {{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
114 {objdump -sj.tdata tlstoc.t}}
115 "tlstoc"}
116 {"TLSTOC dynamic exec" "-melf64ppc tmpdir/tlstoc.o tmpdir/libtlslib.so"
117 "" {}
118 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
119 {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
120 "tlsexetoc"}
121 {"TLSTOC shared" "-shared -melf64ppc tmpdir/tlstoc.o" "" {}
122 {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
123 {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
124 "tlstoc.so"}
125 {"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
126 {{objdump -dj.data symtocbase.d}} "symtocbase.so"}
130 run_ld_link_tests $ppcelftests
132 if [ supports_ppc64 ] then {
133 run_ld_link_tests $ppc64elftests