]>
Commit | Line | Data |
---|---|---|
9ec59d51 | 1 | # Expect script for AIX 5.2+ tests |
a2c58332 | 2 | # Copyright (C) 2009-2022 Free Software Foundation, Inc. |
9ec59d51 RS |
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 | ||
babcb2ea AM |
22 | if { ![istarget "powerpc*-*-aix\[5-9\]*"] && ![istarget "rs6000-*-aix\[5-9\]*"] |
23 | || [istarget "*-*-aix5.\[01\]*"] } { | |
9ec59d51 RS |
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. | |
42 | proc 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)" \ | |
897aea50 | 60 | $ldopts "" \ |
9ec59d51 RS |
61 | "$asopts -a$size --defsym size=$size" \ |
62 | $sources \ | |
63 | $tools \ | |
64 | $output]] | |
65 | } | |
66 | ||
3df13c4a RS |
67 | foreach file { "aix-lineno-1.txt" } { |
68 | remote_upload host "$srcdir/$subdir/$file" "tmpdir/$file" | |
69 | } | |
70 | ||
9ec59d51 | 71 | set 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} | |
babcb2ea | 75 | {{objdump {-dR} aix-abs-branch-1.dd} {nm {} aix-abs-branch-1-SIZE.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} | |
babcb2ea AM |
81 | {{objdump -sRj.data aix-abs-reloc-1-SIZE.od} |
82 | {nm {} aix-abs-reloc-1-SIZE.nd}} | |
0e3212ad RS |
83 | "aix-abs-reloc-1.so"} |
84 | ||
9ec59d51 RS |
85 | {"Core sections test 1" "-shared -bE:aix-core-sec-1.ex" |
86 | "" {aix-core-sec-1.s} | |
87 | {{objdump -h aix-core-sec-1.hd}} | |
88 | "aix-core-sec-1.so"} | |
89 | ||
90 | {"Core sections test 2" "-shared -bE:aix-core-sec-2.ex" | |
91 | "" {aix-core-sec-2.s} | |
92 | {{objdump -h aix-core-sec-2.hd}} | |
93 | "aix-core-sec-2.so"} | |
94 | ||
95 | {"Core sections test 3" "-shared -bE:aix-core-sec-3.ex" | |
96 | "" {aix-core-sec-3.s} | |
97 | {{objdump -h aix-core-sec-3.hd}} | |
98 | "aix-core-sec-3.so"} | |
858ef0ce | 99 | |
5b49f6dc RS |
100 | {"Duplicate symbol check 1 (rel)" "-r" |
101 | "" {aix-no-dup-syms-1a.s aix-no-dup-syms-1b.s} | |
102 | {{nm {} aix-no-dup-syms-1-rel.nd} {objdump -r aix-no-dup-syms-1-rel.rd}} | |
103 | "aix-no-dup-syms-1.o"} | |
104 | ||
105 | {"Duplicate symbol check 1 (shared)" | |
106 | "-shared --allow-multiple-definition -bI:aix-no-dup-syms-1.im -bE:aix-no-dup-syms-1.ex" | |
107 | "" {aix-no-dup-syms-1a.s aix-no-dup-syms-1b.s} | |
babcb2ea AM |
108 | {{nm {} aix-no-dup-syms-1-dso-SIZE.nd} |
109 | {objdump -r aix-no-dup-syms-1-dso-SIZE.rd} | |
110 | {nm -D aix-no-dup-syms-1-dso-SIZE.dnd} | |
111 | {objdump -R aix-no-dup-syms-1-dso-SIZE.drd}} | |
5b49f6dc | 112 | "aix-no-dup-syms-1.so"} |
b64232cc RS |
113 | |
114 | {"Export test 1 (archive)" "" | |
115 | "" {aix-export-1a.s} | |
116 | {} "libaix-export-1.a"} | |
117 | ||
118 | {"Export test 1 (object)" "-r" | |
119 | "" {aix-export-1b.s} | |
120 | {} "aix-export-1.o"} | |
121 | ||
122 | {"Export test 1 (-bexpall)" | |
123 | "-shared -bexpall tmpdir/aix-export-1.o -Ltmpdir -laix-export-1" | |
124 | "" {} | |
babcb2ea | 125 | {{objdump -dj.data aix-export-1-all-SIZE.dd}} |
b64232cc RS |
126 | "aix-export-1-all.so"} |
127 | ||
128 | {"Export test 1 (-bexpfull)" | |
129 | "-shared -bexpfull tmpdir/aix-export-1.o -Ltmpdir -laix-export-1" | |
130 | "" {} | |
babcb2ea | 131 | {{objdump -dj.data aix-export-1-full-SIZE.dd}} |
b64232cc | 132 | "aix-export-1-full.so"} |
5b49f6dc | 133 | |
3023e3f6 RS |
134 | {"Export test 2" "-shared -bexpall" |
135 | {} {aix-export-2.s} | |
babcb2ea | 136 | {{nm -D aix-export-2-SIZE.nd}} "aix-export-2.so"} |
3023e3f6 | 137 | |
7d504122 RS |
138 | {"Garbage collection test 1" |
139 | "-shared -binitfini:init_function:fini_function -bE:aix-gc-1.ex" | |
140 | "" {aix-gc-1.s} | |
54e2dbe0 | 141 | {{objdump {-dz -j.text -j.data} aix-gc-1-SIZE.dd} |
babcb2ea | 142 | {nm {} aix-gc-1-SIZE.nd}} |
7d504122 RS |
143 | "aix-gc-1.so"} |
144 | ||
858ef0ce RS |
145 | {"Glink test 1" |
146 | "-shared -bE:aix-glink-1.ex --unresolved-symbols=ignore-all" | |
147 | "" {aix-glink-1.s} | |
148 | {{objdump {-D -j.text -j.data} aix-glink-1-SIZE.dd}} | |
149 | "aix-glink-1.so"} | |
47dfb2ca | 150 | |
8602d4fe RS |
151 | {"Glink test 2 (part a)" "-shared -bE:aix-glink-2a.ex" |
152 | "" {aix-glink-2a.s} | |
153 | {} | |
154 | "aix-glink-2a.so"} | |
155 | ||
156 | {"Glink test 2 (part b)" "-r" | |
157 | "" {aix-glink-2b.s} | |
158 | {} | |
159 | "aix-glink-2b.ro"} | |
160 | ||
161 | {"Glink test 2 (part c)" "-shared -bE:aix-glink-2c.ex" | |
162 | "" {aix-glink-2c.s} | |
163 | {} | |
164 | "aix-glink-2c.so"} | |
165 | ||
166 | {"Glink test 2" | |
167 | "-e.main tmpdir/aix-glink-2a.so tmpdir/aix-glink-2b.ro tmpdir/aix-glink-2c.so" | |
168 | "" {aix-glink-2d.s} | |
169 | {{objdump -d aix-glink-2-SIZE.dd}} | |
170 | "aix-glink-2"} | |
171 | ||
94313f36 RS |
172 | {"Glink test 3 (shared library a)" |
173 | "-shared -bexpall" | |
174 | "" {aix-glink-3a.s} | |
175 | {} "aix-glink-3a.so"} | |
176 | ||
177 | {"Glink test 3 (shared library b)" | |
178 | "-shared -bexpall" | |
179 | "" {aix-glink-3b.s} | |
180 | {} "aix-glink-3b.so"} | |
181 | ||
182 | {"Glink test 3 (main test)" | |
183 | "-bnoautoimp tmpdir/aix-glink-3b.so tmpdir/aix-glink-3a.so" | |
184 | "" {aix-glink-3.s} | |
babcb2ea | 185 | {{objdump -d aix-glink-3-SIZE.dd}} |
94313f36 RS |
186 | "aix-glink-3"} |
187 | ||
188 | {"Line number test 1 (no discards)" "-e.main" | |
189 | "" {aix-lineno-1.s} | |
babcb2ea | 190 | {{objdump -dS aix-lineno-1a-SIZE.dd} {nm {} aix-lineno-1a-SIZE.nd}} |
94313f36 RS |
191 | "aix-lineno-1a.exe"} |
192 | ||
193 | {"Line number test 1 (discard locals)" "-e.main -x" | |
194 | "" {aix-lineno-1.s} | |
babcb2ea | 195 | {{objdump -dS aix-lineno-1b-SIZE.dd} {nm {} aix-lineno-1b-SIZE.nd}} |
94313f36 RS |
196 | "aix-lineno-1b.exe"} |
197 | ||
b3d1832c RS |
198 | {"Relocatable test 1" "-r" |
199 | "" {aix-rel-1.s} | |
200 | {{objdump -hr aix-rel-1.od}} "aix-rel-1.ro"} | |
201 | ||
c865e45b RS |
202 | {".ref test 1" "-efoo1" |
203 | "" {aix-ref-1.s} | |
204 | {{objdump -dr aix-ref-1-SIZE.od}} | |
205 | "aix-ref-1"} | |
206 | ||
8602d4fe RS |
207 | {"Weak test 1 (rel)" "-r" |
208 | "" {aix-weak-1a.s aix-weak-1b.s} | |
209 | {{nm {} aix-weak-1-rel.nd} {objdump -h aix-weak-1-rel.hd}} | |
210 | "aix-weak-1.o"} | |
211 | ||
212 | {"Weak test 1 (shared, nogc)" "-shared -bE:aix-weak-1.ex -bnogc" | |
213 | "" {aix-weak-1a.s aix-weak-1b.s} | |
babcb2ea AM |
214 | {{nm {} aix-weak-1-dso-SIZE.nd} {objdump -h aix-weak-1-dso-SIZE.hd} |
215 | {nm -D aix-weak-1-dso-SIZE.dnd}} | |
8602d4fe RS |
216 | "aix-weak-1-nogc.so"} |
217 | ||
7d504122 RS |
218 | {"Weak test 1 (shared, gc)" "-shared -bE:aix-weak-1.ex" |
219 | "" {aix-weak-1a.s aix-weak-1b.s} | |
babcb2ea AM |
220 | {{nm {} aix-weak-1-gcdso-SIZE.nd} {objdump -h aix-weak-1-gcdso-SIZE.hd} |
221 | {nm -D aix-weak-1-gcdso-SIZE.dnd}} | |
7d504122 RS |
222 | "aix-weak-1-gc.so"} |
223 | ||
8602d4fe RS |
224 | {"Weak test 2 (library 1)" "-shared -bE:aix-weak-2a.ex" |
225 | "" {aix-weak-2a.s} | |
babcb2ea | 226 | {{nm -D aix-weak-2a-SIZE.nd}} |
8602d4fe RS |
227 | "aix-weak-2a.so"} |
228 | ||
229 | {"Weak test 2 (library 2)" "-shared -bE:aix-weak-2a.ex" | |
230 | "" {aix-weak-2b.s} | |
babcb2ea | 231 | {{nm -D aix-weak-2b-SIZE.nd}} |
8602d4fe RS |
232 | "aix-weak-2b.so"} |
233 | ||
234 | {"Weak test 2 (main library)" | |
235 | "-shared -bE:aix-weak-2c.ex tmpdir/aix-weak-2a.so tmpdir/aix-weak-2b.so" | |
236 | "" {aix-weak-2c.s} | |
babcb2ea | 237 | {{nm {} aix-weak-2c-SIZE.nd} {objdump {-sj.data -R} aix-weak-2c-SIZE.od}} |
8602d4fe RS |
238 | "aix-weak-2c.so"} |
239 | ||
240 | {"Weak test 3 (library)" "-shared -bE:aix-weak-3a.ex" | |
241 | "" {aix-weak-3a.s} | |
242 | {} | |
243 | "aix-weak-3a.so"} | |
244 | ||
245 | {"Weak test 3 (main, dynamic)" "-e.main tmpdir/aix-weak-3a.so" | |
246 | "" {aix-weak-3b.s} | |
247 | {{objdump -Dzrj.data aix-weak-3-SIZE.dd}} | |
248 | "aix-weak-3"} | |
249 | ||
47dfb2ca RS |
250 | {"TOC test 1" "-shared -bE:aix-toc-1.ex" |
251 | "" {aix-toc-1a.s aix-toc-1b.s} | |
252 | {{objdump -dr aix-toc-1-SIZE.dd}} | |
253 | "aix-toc-1.so"} | |
c5df7e44 CC |
254 | |
255 | {"Negative relocation test 1" "-shared -bE:aix-neg-reloc.ex" | |
256 | "" {aix-neg-reloc.s} | |
257 | {{objdump -dr aix-neg-reloc-SIZE.d}} | |
258 | "aix-neg-reloc.so"} | |
259 | ||
9ec59d51 RS |
260 | } |
261 | ||
262 | foreach test $aix52tests { | |
263 | foreach { name ldopts asopts sources tools output } $test { | |
264 | run_aix_test 32 $name $ldopts $asopts $sources $tools $output | |
265 | run_aix_test 64 $name $ldopts $asopts $sources $tools $output | |
266 | } | |
267 | } | |
8602d4fe | 268 | |
94313f36 RS |
269 | run_dump_test "aix-glink-1-32" |
270 | run_dump_test "aix-glink-1-64" | |
271 | run_dump_test "aix-glink-3-32" | |
272 | run_dump_test "aix-glink-3-64" | |
8602d4fe RS |
273 | run_dump_test "aix-weak-3-32" |
274 | run_dump_test "aix-weak-3-64" | |
4a403be0 CC |
275 | |
276 | ||
277 | # Tests added for features in AIX 7+. | |
278 | ||
279 | set aix7tests { | |
280 | {"Large TOC test 1" "-shared -bE:aix-largetoc-1.ex" | |
281 | "" {aix-largetoc-1.s} | |
282 | {{objdump -dr aix-largetoc-1-SIZE.d}} | |
283 | "aix-largetoc-1.so"} | |
1b2cb8e2 CC |
284 | |
285 | {"TLS relocations" "-shared -bE:aix-tls-reloc.ex" | |
286 | "" {aix-tls-reloc.s} | |
287 | {{objdump -dr aix-tls-reloc-SIZE.d}} | |
288 | "aix-tls-reloc.so"} | |
289 | ||
290 | {"TLS section" "-shared -bE:aix-tls-section.ex" | |
291 | "" {aix-tls-section.s} | |
292 | {{objdump -hw aix-tls-section-SIZE.d}} | |
293 | "aix-tls-section.so"} | |
4a403be0 CC |
294 | } |
295 | ||
296 | foreach test $aix7tests { | |
297 | foreach { name ldopts asopts sources tools output } $test { | |
298 | run_aix_test 32 $name $ldopts $asopts $sources $tools $output | |
299 | run_aix_test 64 $name $ldopts $asopts $sources $tools $output | |
300 | } | |
301 | } |