bfd/
[deliverable/binutils-gdb.git] / ld / testsuite / ld-powerpc / aix52.exp
CommitLineData
9ec59d51
RS
1# Expect script for AIX 5.2+ tests
2# Copyright 2009 Free Software Foundation
3#
4# This file is part of the GNU Binutils.
5#
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.
10#
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.
15#
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.
20#
21
22if { ![istarget "powerpc*-*-aix\[5-9\]*"]
23 || [istarget "powerpc*-*-aix5.\[01\]*"] } {
24 return
25}
26
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.
29#
30# Make the following changes before running the test:
31#
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.
42proc run_aix_test { size name ldopts asopts sources tools output } {
43 global srcdir subdir
44
45 if { $size == 64 } {
46 regsub -all {tmpdir/aix-} $ldopts {tmpdir/aix64-} ldopts
47 regsub {^aix} $output {aix64} output
48
49 regsub -all -- {-laix-} $ldopts {-laix64-} ldopts
50 regsub {^libaix} $output {libaix64} output
51 }
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"
57 }
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]]
65}
66
3df13c4a
RS
67foreach file { "aix-lineno-1.txt" } {
68 remote_upload host "$srcdir/$subdir/$file" "tmpdir/$file"
69}
70
9ec59d51 71set aix52tests {
12b2cce9
RS
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}
c4037431 75 {{objdump {-dR} aix-abs-branch-1.dd} {nm {} aix-abs-branch-1.nd}}
12b2cce9
RS
76 "aix-abs-branch-1.so"}
77
0e3212ad
RS
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}
c4037431 81 {{objdump -sRj.data aix-abs-reloc-1.od} {nm {} aix-abs-reloc-1.nd}}
0e3212ad
RS
82 "aix-abs-reloc-1.so"}
83
9ec59d51
RS
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"}
88
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"}
93
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"}
858ef0ce 98
5b49f6dc
RS
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"}
103
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"}
b64232cc
RS
110
111 {"Export test 1 (archive)" ""
112 "" {aix-export-1a.s}
113 {} "libaix-export-1.a"}
114
115 {"Export test 1 (object)" "-r"
116 "" {aix-export-1b.s}
117 {} "aix-export-1.o"}
118
119 {"Export test 1 (-bexpall)"
120 "-shared -bexpall tmpdir/aix-export-1.o -Ltmpdir -laix-export-1"
121 "" {}
122 {{objdump -dj.data aix-export-1-all.dd}}
123 "aix-export-1-all.so"}
124
125 {"Export test 1 (-bexpfull)"
126 "-shared -bexpfull tmpdir/aix-export-1.o -Ltmpdir -laix-export-1"
127 "" {}
128 {{objdump -dj.data aix-export-1-full.dd}}
129 "aix-export-1-full.so"}
5b49f6dc 130
3023e3f6
RS
131 {"Export test 2" "-shared -bexpall"
132 {} {aix-export-2.s}
133 {{nm -D aix-export-2.nd}} "aix-export-2.so"}
134
7d504122
RS
135 {"Garbage collection test 1"
136 "-shared -binitfini:init_function:fini_function -bE:aix-gc-1.ex"
137 "" {aix-gc-1.s}
54e2dbe0
RS
138 {{objdump {-dz -j.text -j.data} aix-gc-1-SIZE.dd}
139 {nm {} aix-gc-1.nd}}
7d504122
RS
140 "aix-gc-1.so"}
141
858ef0ce
RS
142 {"Glink test 1"
143 "-shared -bE:aix-glink-1.ex --unresolved-symbols=ignore-all"
144 "" {aix-glink-1.s}
145 {{objdump {-D -j.text -j.data} aix-glink-1-SIZE.dd}}
146 "aix-glink-1.so"}
47dfb2ca 147
8602d4fe
RS
148 {"Glink test 2 (part a)" "-shared -bE:aix-glink-2a.ex"
149 "" {aix-glink-2a.s}
150 {}
151 "aix-glink-2a.so"}
152
153 {"Glink test 2 (part b)" "-r"
154 "" {aix-glink-2b.s}
155 {}
156 "aix-glink-2b.ro"}
157
158 {"Glink test 2 (part c)" "-shared -bE:aix-glink-2c.ex"
159 "" {aix-glink-2c.s}
160 {}
161 "aix-glink-2c.so"}
162
163 {"Glink test 2"
164 "-e.main tmpdir/aix-glink-2a.so tmpdir/aix-glink-2b.ro tmpdir/aix-glink-2c.so"
165 "" {aix-glink-2d.s}
166 {{objdump -d aix-glink-2-SIZE.dd}}
167 "aix-glink-2"}
168
94313f36
RS
169 {"Glink test 3 (shared library a)"
170 "-shared -bexpall"
171 "" {aix-glink-3a.s}
172 {} "aix-glink-3a.so"}
173
174 {"Glink test 3 (shared library b)"
175 "-shared -bexpall"
176 "" {aix-glink-3b.s}
177 {} "aix-glink-3b.so"}
178
179 {"Glink test 3 (main test)"
180 "-bnoautoimp tmpdir/aix-glink-3b.so tmpdir/aix-glink-3a.so"
181 "" {aix-glink-3.s}
182 {{objdump -d aix-glink-3.dd}}
183 "aix-glink-3"}
184
185 {"Line number test 1 (no discards)" "-e.main"
186 "" {aix-lineno-1.s}
187 {{objdump -dS aix-lineno-1a.dd} {nm {} aix-lineno-1a.nd}}
188 "aix-lineno-1a.exe"}
189
190 {"Line number test 1 (discard locals)" "-e.main -x"
191 "" {aix-lineno-1.s}
192 {{objdump -dS aix-lineno-1b.dd} {nm {} aix-lineno-1b.nd}}
193 "aix-lineno-1b.exe"}
194
b3d1832c
RS
195 {"Relocatable test 1" "-r"
196 "" {aix-rel-1.s}
197 {{objdump -hr aix-rel-1.od}} "aix-rel-1.ro"}
198
8602d4fe
RS
199 {"Weak test 1 (rel)" "-r"
200 "" {aix-weak-1a.s aix-weak-1b.s}
201 {{nm {} aix-weak-1-rel.nd} {objdump -h aix-weak-1-rel.hd}}
202 "aix-weak-1.o"}
203
204 {"Weak test 1 (shared, nogc)" "-shared -bE:aix-weak-1.ex -bnogc"
205 "" {aix-weak-1a.s aix-weak-1b.s}
206 {{nm {} aix-weak-1-dso.nd} {objdump -h aix-weak-1-dso.hd}
207 {nm -D aix-weak-1-dso.dnd}}
208 "aix-weak-1-nogc.so"}
209
7d504122
RS
210 {"Weak test 1 (shared, gc)" "-shared -bE:aix-weak-1.ex"
211 "" {aix-weak-1a.s aix-weak-1b.s}
212 {{nm {} aix-weak-1-gcdso.nd} {objdump -h aix-weak-1-gcdso.hd}
213 {nm -D aix-weak-1-gcdso.dnd}}
214 "aix-weak-1-gc.so"}
215
8602d4fe
RS
216 {"Weak test 2 (library 1)" "-shared -bE:aix-weak-2a.ex"
217 "" {aix-weak-2a.s}
218 {{nm -D aix-weak-2a.nd}}
219 "aix-weak-2a.so"}
220
221 {"Weak test 2 (library 2)" "-shared -bE:aix-weak-2a.ex"
222 "" {aix-weak-2b.s}
223 {{nm -D aix-weak-2b.nd}}
224 "aix-weak-2b.so"}
225
226 {"Weak test 2 (main library)"
227 "-shared -bE:aix-weak-2c.ex tmpdir/aix-weak-2a.so tmpdir/aix-weak-2b.so"
228 "" {aix-weak-2c.s}
229 {{nm {} aix-weak-2c.nd} {objdump {-sj.data -R} aix-weak-2c.od}}
230 "aix-weak-2c.so"}
231
232 {"Weak test 3 (library)" "-shared -bE:aix-weak-3a.ex"
233 "" {aix-weak-3a.s}
234 {}
235 "aix-weak-3a.so"}
236
237 {"Weak test 3 (main, dynamic)" "-e.main tmpdir/aix-weak-3a.so"
238 "" {aix-weak-3b.s}
239 {{objdump -Dzrj.data aix-weak-3-SIZE.dd}}
240 "aix-weak-3"}
241
47dfb2ca
RS
242 {"TOC test 1" "-shared -bE:aix-toc-1.ex"
243 "" {aix-toc-1a.s aix-toc-1b.s}
244 {{objdump -dr aix-toc-1-SIZE.dd}}
245 "aix-toc-1.so"}
9ec59d51
RS
246}
247
248foreach test $aix52tests {
249 foreach { name ldopts asopts sources tools output } $test {
250 run_aix_test 32 $name $ldopts $asopts $sources $tools $output
251 run_aix_test 64 $name $ldopts $asopts $sources $tools $output
252 }
253}
8602d4fe 254
94313f36
RS
255run_dump_test "aix-glink-1-32"
256run_dump_test "aix-glink-1-64"
257run_dump_test "aix-glink-3-32"
258run_dump_test "aix-glink-3-64"
8602d4fe
RS
259run_dump_test "aix-weak-3-32"
260run_dump_test "aix-weak-3-64"
This page took 0.043774 seconds and 4 git commands to generate.