PR ld/1775
[binutils/xnox.git] / ld / testsuite / ld-powerpc / powerpc.exp
blobe43a295319970505a0be393be5789a20b14dd5df
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 # powerpc ELF only at the moment.
25 if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
26      || [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
27      || [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
28      || [istarget "*-*-beos*"] } {
29     return
32 proc supports_ppc64 { } {
33     global ld
35     catch "exec $ld --help | grep emulations" tmp
36     if [ string match "*elf64ppc*" $tmp ] then {
37         return 1
38     } else {
39         return 0
40     }
43 # List contains test-items with 3 items followed by 2 lists:
44 # 0:name 1:ld options 2:assembler options
45 # 3:filenames of assembler files 4: action and options. 5: name of output file
47 # Actions:
48 # objdump: Apply objdump options on result.  Compare with regex (last arg).
49 # nm: Apply nm options on result.  Compare with regex (last arg).
50 # readelf: Apply readelf options on result.  Compare with regex (last arg).
52 set ppcelftests {
53     {"Reloc section order" "-melf32ppc -shared -z nocombreloc" "-a32" {reloc.s}
54      {{objdump -hw reloc.d}} "reloc.so"}
55     {"APUinfo section processing" "-melf32ppc"
56      "-a32 -me500" {apuinfo1.s apuinfo2.s}
57     {{readelf -x2 apuinfo.rd}} "apuinfo"}
58     {"TLS32 static exec" "-melf32ppc" "-a32"  {tls32.s tlslib32.s}
59      {{objdump -dr tls32.d} {objdump -sj.got tls32.g}
60       {objdump -sj.tdata tls32.t}}
61      "tls32"}
62     {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" {}
63      {} "libtlslib32.so"}
64     {"TLS32 dynamic exec" "-melf32ppc tmpdir/tls32.o tmpdir/libtlslib32.so" "" {}
65      {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
66       {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
67       "tlsexe32"}
68     {"TLS32 shared" "-shared -melf32ppc tmpdir/tls32.o" "" {}
69      {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
70       {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
71       "tls32.so"}
72     {"Shared library with global symbol" "-shared -melf32ppc" "-a32" {sdalib.s}
73      {} "sdalib.so"}
74     {"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "-a32" {sdadyn.s}
75      {{objdump -R sdadyn.d}} "sdadyn"}
78 set ppc64elftests {
79     {"TLS static exec" "-melf64ppc" "-a64"  {tls.s tlslib.s}
80      {{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}}
81       "tls"}
82     {"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
83      {} "libtlslib.so"}
84     {"TLS dynamic exec" "-melf64ppc tmpdir/tls.o tmpdir/libtlslib.so" "" {}
85      {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
86       {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
87       "tlsexe"}
88     {"TLS shared" "-shared -melf64ppc tmpdir/tls.o" "" {}
89      {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
90       {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
91       "tls.so"}
92     {"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "-a64"  {tlstoc.s}
93      {{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
94       {objdump -sj.tdata tlstoc.t}}
95       "tlstoc"}
96     {"TLSTOC dynamic exec" "-melf64ppc tmpdir/tlstoc.o tmpdir/libtlslib.so"
97      "" {}
98      {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
99       {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
100       "tlsexetoc"}
101     {"TLSTOC shared" "-shared -melf64ppc tmpdir/tlstoc.o" "" {}
102      {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
103       {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
104       "tlstoc.so"}
105     {"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
106         {{objdump -dj.data symtocbase.d}} "symtocbase.so"}
110 run_ld_link_tests $ppcelftests
112 if [ supports_ppc64 ] then {
113     run_ld_link_tests $ppc64elftests