bfd/
[binutils.git] / ld / testsuite / ld-powerpc / aix52.exp
blob330de2778521a27cd790684e1c92ecd9cb15485b
1 # Expect script for AIX 5.2+ tests
2 # Copyright 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*-*-aix\[5-9\]*"]
23 || [istarget "powerpc*-*-aix5.\[01\]*"] } {
24 return
27 # Run a run_link_tests-style test for AIX. SIZE selects the target size
28 # (32 or 64). The other arguments are elements of a run_link_tests test.
30 # Make the following changes before running the test:
32 # - Mention SIZE in the test name.
33 # - Add "-aSIZE --defsym size=SIZE" to the assembler options.
34 # - Add the source directory to any "-bI:" and "-bE:" linker options.
35 # - Add "-bSIZE" to the linker options.
36 # - Add "-XSIZE" to the archiver options.
37 # - Replace "SIZE" with SIZE in TOOLS.
38 # - When testing 64-bit targets:
39 # - Turn tmpdir/aix-* into tmpdir/aix64-*.
40 # - Turn tmpdir/libaix-* into tmpdir/libaix64-*.
41 # - Turn -laix* into -laix64*, to compensate for the above.
42 proc run_aix_test { size name ldopts asopts sources tools output } {
43 global srcdir subdir
45 if { $size == 64 } {
46 regsub -all {tmpdir/aix-} $ldopts {tmpdir/aix64-} ldopts
47 regsub {^aix} $output {aix64} output
49 regsub -all -- {-laix-} $ldopts {-laix64-} ldopts
50 regsub {^libaix} $output {libaix64} output
52 if { [regexp {.a$} $output] } {
53 append ldopts " -X$size"
54 } else {
55 regsub -all {(-b[IE]):} $ldopts "\\1:$srcdir/$subdir/" ldopts
56 append ldopts " -b$size"
58 regsub -all {SIZE} $tools $size tools
59 run_ld_link_tests [list [list "$name ($size-bit)" \
60 $ldopts \
61 "$asopts -a$size --defsym size=$size" \
62 $sources \
63 $tools \
64 $output]]
67 foreach file { "aix-lineno-1.txt" } {
68 remote_upload host "$srcdir/$subdir/$file" "tmpdir/$file"
71 set aix52tests {
72 {"Absolute branch test 1"
73 "-shared -bI:aix-abs-branch-1.im -bE:aix-abs-branch-1.ex"
74 "" {aix-abs-branch-1.s}
75 {{objdump {-dR} aix-abs-branch-1.dd} {nm {} aix-abs-branch-1.nd}}
76 "aix-abs-branch-1.so"}
78 {"Relocations against absolute symbols 1"
79 "-shared -bI:aix-abs-reloc-1.im -bE:aix-abs-reloc-1.ex"
80 {} {aix-abs-reloc-1.s}
81 {{objdump -sRj.data aix-abs-reloc-1.od} {nm {} aix-abs-reloc-1.nd}}
82 "aix-abs-reloc-1.so"}
84 {"Core sections test 1" "-shared -bE:aix-core-sec-1.ex"
85 "" {aix-core-sec-1.s}
86 {{objdump -h aix-core-sec-1.hd}}
87 "aix-core-sec-1.so"}
89 {"Core sections test 2" "-shared -bE:aix-core-sec-2.ex"
90 "" {aix-core-sec-2.s}
91 {{objdump -h aix-core-sec-2.hd}}
92 "aix-core-sec-2.so"}
94 {"Core sections test 3" "-shared -bE:aix-core-sec-3.ex"
95 "" {aix-core-sec-3.s}
96 {{objdump -h aix-core-sec-3.hd}}
97 "aix-core-sec-3.so"}
99 {"Duplicate symbol check 1 (rel)" "-r"
100 "" {aix-no-dup-syms-1a.s aix-no-dup-syms-1b.s}
101 {{nm {} aix-no-dup-syms-1-rel.nd} {objdump -r aix-no-dup-syms-1-rel.rd}}
102 "aix-no-dup-syms-1.o"}
104 {"Duplicate symbol check 1 (shared)"
105 "-shared --allow-multiple-definition -bI:aix-no-dup-syms-1.im -bE:aix-no-dup-syms-1.ex"
106 "" {aix-no-dup-syms-1a.s aix-no-dup-syms-1b.s}
107 {{nm {} aix-no-dup-syms-1-dso.nd} {objdump -r aix-no-dup-syms-1-dso.rd}
108 {nm -D aix-no-dup-syms-1-dso.dnd} {objdump -R aix-no-dup-syms-1-dso.drd}}
109 "aix-no-dup-syms-1.so"}
111 {"Garbage collection test 1"
112 "-shared -binitfini:init_function:fini_function -bE:aix-gc-1.ex"
113 "" {aix-gc-1.s}
114 {{objdump {-dz -j.text -j.data} aix-gc-1-SIZE.dd}}
115 "aix-gc-1.so"}
117 {"Glink test 1"
118 "-shared -bE:aix-glink-1.ex --unresolved-symbols=ignore-all"
119 "" {aix-glink-1.s}
120 {{objdump {-D -j.text -j.data} aix-glink-1-SIZE.dd}}
121 "aix-glink-1.so"}
123 {"Line number test 1 (no discards)" "-e.main"
124 "" {aix-lineno-1.s}
125 {{objdump -dS aix-lineno-1a.dd} {nm {} aix-lineno-1a.nd}}
126 "aix-lineno-1a.exe"}
128 {"Line number test 1 (discard locals)" "-e.main -x"
129 "" {aix-lineno-1.s}
130 {{objdump -dS aix-lineno-1b.dd} {nm {} aix-lineno-1b.nd}}
131 "aix-lineno-1b.exe"}
133 {"Glink test 2 (part a)" "-shared -bE:aix-glink-2a.ex"
134 "" {aix-glink-2a.s}
136 "aix-glink-2a.so"}
138 {"Glink test 2 (part b)" "-r"
139 "" {aix-glink-2b.s}
141 "aix-glink-2b.ro"}
143 {"Glink test 2 (part c)" "-shared -bE:aix-glink-2c.ex"
144 "" {aix-glink-2c.s}
146 "aix-glink-2c.so"}
148 {"Glink test 2"
149 "-e.main tmpdir/aix-glink-2a.so tmpdir/aix-glink-2b.ro tmpdir/aix-glink-2c.so"
150 "" {aix-glink-2d.s}
151 {{objdump -d aix-glink-2-SIZE.dd}}
152 "aix-glink-2"}
154 {"Weak test 1 (rel)" "-r"
155 "" {aix-weak-1a.s aix-weak-1b.s}
156 {{nm {} aix-weak-1-rel.nd} {objdump -h aix-weak-1-rel.hd}}
157 "aix-weak-1.o"}
159 {"Weak test 1 (shared, nogc)" "-shared -bE:aix-weak-1.ex -bnogc"
160 "" {aix-weak-1a.s aix-weak-1b.s}
161 {{nm {} aix-weak-1-dso.nd} {objdump -h aix-weak-1-dso.hd}
162 {nm -D aix-weak-1-dso.dnd}}
163 "aix-weak-1-nogc.so"}
165 {"Weak test 1 (shared, gc)" "-shared -bE:aix-weak-1.ex"
166 "" {aix-weak-1a.s aix-weak-1b.s}
167 {{nm {} aix-weak-1-gcdso.nd} {objdump -h aix-weak-1-gcdso.hd}
168 {nm -D aix-weak-1-gcdso.dnd}}
169 "aix-weak-1-gc.so"}
171 {"Weak test 2 (library 1)" "-shared -bE:aix-weak-2a.ex"
172 "" {aix-weak-2a.s}
173 {{nm -D aix-weak-2a.nd}}
174 "aix-weak-2a.so"}
176 {"Weak test 2 (library 2)" "-shared -bE:aix-weak-2a.ex"
177 "" {aix-weak-2b.s}
178 {{nm -D aix-weak-2b.nd}}
179 "aix-weak-2b.so"}
181 {"Weak test 2 (main library)"
182 "-shared -bE:aix-weak-2c.ex tmpdir/aix-weak-2a.so tmpdir/aix-weak-2b.so"
183 "" {aix-weak-2c.s}
184 {{nm {} aix-weak-2c.nd} {objdump {-sj.data -R} aix-weak-2c.od}}
185 "aix-weak-2c.so"}
187 {"Weak test 3 (library)" "-shared -bE:aix-weak-3a.ex"
188 "" {aix-weak-3a.s}
190 "aix-weak-3a.so"}
192 {"Weak test 3 (main, dynamic)" "-e.main tmpdir/aix-weak-3a.so"
193 "" {aix-weak-3b.s}
194 {{objdump -Dzrj.data aix-weak-3-SIZE.dd}}
195 "aix-weak-3"}
197 {"TOC test 1" "-shared -bE:aix-toc-1.ex"
198 "" {aix-toc-1a.s aix-toc-1b.s}
199 {{objdump -dr aix-toc-1-SIZE.dd}}
200 "aix-toc-1.so"}
203 foreach test $aix52tests {
204 foreach { name ldopts asopts sources tools output } $test {
205 run_aix_test 32 $name $ldopts $asopts $sources $tools $output
206 run_aix_test 64 $name $ldopts $asopts $sources $tools $output
210 run_dump_test "aix-weak-3-32"
211 run_dump_test "aix-weak-3-64"