new ppc64 tls tests
[binutils-gdb.git] / ld / testsuite / ld-powerpc / powerpc.exp
1 # Expect script for ld-powerpc tests
2 # Copyright 2002, 2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #
18
19 if { ![istarget "powerpc*-*-*"] } {
20 return
21 }
22
23 # powerpc ELF only at the moment.
24
25 if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
26 || [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
27 || [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
28 || [istarget "*-*-beos*"] } {
29 return
30 }
31
32 proc supports_ppc64 { } {
33 global ld
34
35 catch "exec $ld --help | grep emulations" tmp
36 if [ string match "*elf64ppc*" $tmp ] then {
37 return 1
38 } else {
39 return 0
40 }
41 }
42
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
46
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).
51
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 -x5 apuinfo.rd}} "apuinfo"}
58 }
59
60 set ppc64elftests {
61 {"TLS static exec" "-melf64ppc" "-a64" {tls.s tlslib.s}
62 {{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}}
63 "tls"}
64 {"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
65 {} "libtlslib.so"}
66 {"TLS dynamic exec" "-melf64ppc tmpdir/tls.o tmpdir/libtlslib.so" "" {}
67 {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
68 {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
69 "tlsexe"}
70 {"TLS shared" "-shared -melf64ppc tmpdir/tls.o" "" {}
71 {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
72 {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
73 "tls.so"}
74 {"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "-a64" {tlstoc.s}
75 {{objdump -dr tlstoc.d} {objdump -sj.toc tlstoc.g}
76 {objdump -sj.tdata tlstoc.t}}
77 "tlstoc"}
78 {"TLSTOC dynamic exec" "-melf64ppc tmpdir/tlstoc.o tmpdir/libtlslib.so"
79 "" {}
80 {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
81 {objdump -sj.toc tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
82 "tlsexetoc"}
83 {"TLSTOC shared" "-shared -melf64ppc tmpdir/tlstoc.o" "" {}
84 {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
85 {objdump -sj.toc tlstocso.g} {objdump -sj.tdata tlstocso.t}}
86 "tlstoc.so"}
87 }
88
89
90 run_ld_link_tests $ppcelftests
91
92 if [ supports_ppc64 ] then {
93 run_ld_link_tests $ppc64elftests
94 }