1 # Expect script for various AARCH64 ELF tests.
2 # Copyright (C) 2009-2017 Free Software Foundation, Inc.
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,
21 # Exclude non-aarch64-ELF targets.
22 if { ![is_elf_format] || ![istarget "aarch64*-*-*"] } {
26 # List contains test-items with 3 items followed by 2 lists:
27 # 0:name 1:ld early options 2:ld late options 3:assembler options
28 # 4:filenames of assembler files 5: action and options. 6: name of output file
31 # objdump: Apply objdump options on result. Compare with regex (last arg).
32 # nm: Apply nm options on result. Compare with regex (last arg).
33 # readelf: Apply readelf options on result. Compare with regex (last arg).
36 {"Erratum 835769 dump test"
37 "--fix-cortex-a53-835769" "" "" {erratum835769.s}
38 {{objdump -dr erratum835769.d}}
40 {"Erratum 835769 dump test -shared"
41 "--fix-cortex-a53-835769 -shared" "" "" {erratum835769.s}
42 {{objdump -dr erratum835769.d}}
46 proc aarch64_choose_ilp32_emul {} {
47 if [istarget *linux*] then {
48 if [istarget aarch64_be-*] {
49 return "aarch64linux32b"
51 return "aarch64linux32"
53 if [istarget aarch64_be-*] {
54 return "aarch64elf32b"
59 proc aarch64_choose_lp64_emul {} {
60 if [istarget *linux*] then {
61 if [istarget aarch64_be-*] {
62 return "aarch64linuxb"
66 if [istarget aarch64_be-*] {
72 proc run_dump_test_lp64 { testname } {
73 run_dump_test $testname \
74 [list [list as "-mabi=lp64"] \
75 [list ld [concat "-m " [aarch64_choose_lp64_emul]]]]
78 set eh-frame-merge-lp64 [list [list "EH Frame merge" \
79 [concat "-m " [aarch64_choose_lp64_emul] \
81 "" "-mabi=lp64" {eh-frame-bar.s eh-frame-foo.s} \
82 {{objdump --dwarf=frames eh-frame.d}} \
85 run_ld_link_tests $aarch64elftests
86 run_ld_link_tests eh-frame-merge-lp64
88 run_dump_test "erratum843419"
91 run_dump_test_lp64 "weak-undefined"
92 run_dump_test "emit-relocs-28"
93 run_dump_test "emit-relocs-86"
94 run_dump_test "emit-relocs-86-overflow"
95 run_dump_test "emit-relocs-87"
96 run_dump_test "emit-relocs-88"
97 run_dump_test "emit-relocs-88-overflow"
98 run_dump_test "emit-relocs-89"
99 run_dump_test "emit-relocs-90"
100 run_dump_test "emit-relocs-90-overflow"
101 run_dump_test "emit-relocs-92"
102 run_dump_test_lp64 "emit-relocs-257"
103 run_dump_test_lp64 "emit-relocs-257-be"
104 # 258 is tested in 257
105 # 259 is tested in 257
106 run_dump_test_lp64 "emit-relocs-260"
107 run_dump_test_lp64 "emit-relocs-260-be"
108 # 261 is tested by 260
109 run_dump_test_lp64 "emit-relocs-262"
110 run_dump_test_lp64 "emit-relocs-263"
111 run_dump_test_lp64 "emit-relocs-264"
112 run_dump_test_lp64 "emit-relocs-264-bad"
113 run_dump_test_lp64 "emit-relocs-265"
114 run_dump_test_lp64 "emit-relocs-266"
115 run_dump_test_lp64 "emit-relocs-266-bad"
116 run_dump_test_lp64 "emit-relocs-267"
117 run_dump_test_lp64 "emit-relocs-268"
118 run_dump_test_lp64 "emit-relocs-268-bad"
119 run_dump_test_lp64 "emit-relocs-269"
120 run_dump_test_lp64 "emit-relocs-269-bad"
121 run_dump_test_lp64 "emit-relocs-270"
122 run_dump_test_lp64 "emit-relocs-270-bad"
123 run_dump_test_lp64 "emit-relocs-270-overflow"
124 run_dump_test_lp64 "emit-relocs-271"
125 run_dump_test_lp64 "emit-relocs-271-overflow"
126 run_dump_test_lp64 "emit-relocs-272"
127 run_dump_test_lp64 "emit-relocs-272-overflow"
128 run_dump_test_lp64 "emit-relocs-273"
129 run_dump_test_lp64 "emit-relocs-274"
130 run_dump_test_lp64 "emit-relocs-275"
131 run_dump_test_lp64 "emit-relocs-276"
132 run_dump_test_lp64 "emit-relocs-277"
133 run_dump_test_lp64 "emit-relocs-278"
134 run_dump_test_lp64 "emit-relocs-279"
135 run_dump_test_lp64 "emit-relocs-279-bad"
136 run_dump_test_lp64 "emit-relocs-280"
138 run_dump_test_lp64 "emit-relocs-282"
139 run_dump_test_lp64 "emit-relocs-283"
140 run_dump_test_lp64 "emit-relocs-284"
141 run_dump_test_lp64 "emit-relocs-285"
142 run_dump_test_lp64 "emit-relocs-286"
143 run_dump_test_lp64 "emit-relocs-286-bad"
144 # 287-298 are not done yet
145 run_dump_test_lp64 "emit-relocs-299"
146 # 300 is not done yet
147 run_dump_test_lp64 "emit-relocs-301"
148 run_dump_test_lp64 "emit-relocs-301-be"
149 run_dump_test_lp64 "emit-relocs-302"
150 run_dump_test_lp64 "emit-relocs-302-be"
151 # 303-308 are not done yet
152 run_dump_test_lp64 "emit-relocs-309-up"
153 run_dump_test_lp64 "emit-relocs-309-low"
154 run_dump_test_lp64 "emit-relocs-309-up-bad"
155 run_dump_test_lp64 "emit-relocs-309-low-bad"
156 run_dump_test_lp64 "emit-relocs-310"
157 run_dump_test_lp64 "emit-relocs-310-be"
158 run_dump_test_lp64 "emit-relocs-311"
159 run_dump_test_lp64 "emit-relocs-312"
160 run_dump_test_lp64 "emit-relocs-313"
161 run_dump_test_lp64 "emit-relocs-515"
162 run_dump_test_lp64 "emit-relocs-515-be"
163 run_dump_test_lp64 "emit-relocs-516"
164 run_dump_test_lp64 "emit-relocs-516-be"
165 run_dump_test_lp64 "emit-relocs-523"
166 run_dump_test_lp64 "emit-relocs-524"
167 run_dump_test_lp64 "emit-relocs-525"
168 run_dump_test_lp64 "emit-relocs-526"
169 run_dump_test_lp64 "emit-relocs-526-overflow"
170 run_dump_test_lp64 "emit-relocs-527"
171 run_dump_test_lp64 "emit-relocs-528"
172 run_dump_test_lp64 "emit-relocs-528-overflow"
173 run_dump_test_lp64 "emit-relocs-529"
174 run_dump_test_lp64 "emit-relocs-529-overflow"
175 run_dump_test_lp64 "emit-relocs-530"
176 run_dump_test_lp64 "emit-relocs-531"
177 run_dump_test_lp64 "emit-relocs-531-overflow"
178 run_dump_test_lp64 "emit-relocs-532"
179 run_dump_test_lp64 "emit-relocs-533"
180 run_dump_test_lp64 "emit-relocs-533-overflow"
181 run_dump_test_lp64 "emit-relocs-534"
182 run_dump_test_lp64 "emit-relocs-535"
183 run_dump_test_lp64 "emit-relocs-535-overflow"
184 run_dump_test_lp64 "emit-relocs-536"
185 run_dump_test_lp64 "emit-relocs-537"
186 run_dump_test_lp64 "emit-relocs-537-overflow"
187 run_dump_test_lp64 "emit-relocs-538"
189 run_dump_test "reloc-overflow-bad"
191 # test addend correctness when --emit-relocs specified for non-relocatable obj.
192 run_dump_test_lp64 "emit-relocs-local-addend"
193 # test addend correctness when -r specified.
194 run_dump_test_lp64 "local-addend-r"
196 # test error handling on pcrel relocation for shared libraries.
197 run_dump_test_lp64 "pcrel_pic_undefined"
198 run_dump_test_lp64 "pcrel_pic_defined_local"
200 run_dump_test "limit-b"
201 run_dump_test "limit-bl"
202 run_dump_test "farcall-back"
203 run_dump_test "farcall-b-defsym"
204 run_dump_test "farcall-bl-defsym"
205 run_dump_test "farcall-b-gsym"
206 run_dump_test "farcall-b-plt"
207 run_dump_test "farcall-bl-plt"
208 run_dump_test "farcall-bl"
209 run_dump_test "farcall-b"
210 run_dump_test "farcall-b-none-function"
211 run_dump_test "farcall-bl-none-function"
212 run_dump_test "farcall-b-section"
213 run_dump_test "farcall-bl-section"
215 run_dump_test "tls-relax-all"
216 run_dump_test "tls-relax-gd-le"
217 run_dump_test "tls-relax-gdesc-le"
218 run_dump_test "tls-relax-gd-ie-ilp32"
219 run_dump_test "tls-relax-gd-ie"
220 run_dump_test_lp64 "tls-relax-large-gd-ie"
221 run_dump_test_lp64 "tls-relax-large-gd-ie-be"
222 run_dump_test_lp64 "tls-relax-large-gd-le"
223 run_dump_test_lp64 "tls-relax-large-gd-le-be"
224 run_dump_test_lp64 "tls-relax-large-desc-ie"
225 run_dump_test_lp64 "tls-relax-large-desc-ie-be"
226 run_dump_test_lp64 "tls-relax-large-desc-le"
227 run_dump_test_lp64 "tls-relax-large-desc-le-be"
228 run_dump_test "tls-relax-gdesc-ie"
229 run_dump_test "tls-relax-ie-le"
230 run_dump_test "tls-relax-ld-le-small"
231 run_dump_test "tls-relax-ld-le-small-ilp32"
232 run_dump_test "tls-relax-ld-le-tiny"
233 run_dump_test "tls-relax-ld-le-tiny-ilp32"
234 run_dump_test "tls-desc-ie"
235 run_dump_test "tls-relax-gdesc-ie-2"
236 run_dump_test "tls-relax-gdesc-le-2"
237 run_dump_test "tls-relax-ie-le-2"
238 run_dump_test "tls-relax-ie-le-3"
239 run_dump_test "tls-tiny-gd"
240 run_dump_test "tls-tiny-gd-ie"
241 run_dump_test "tls-tiny-gd-le"
242 run_dump_test "tls-tiny-desc"
243 run_dump_test "tls-tiny-desc-ie"
244 run_dump_test "tls-tiny-desc-le"
245 run_dump_test "tls-tiny-ie"
246 run_dump_test_lp64 "tls-large-ie"
247 run_dump_test_lp64 "tls-large-ie-be"
248 run_dump_test_lp64 "tls-large-desc"
249 run_dump_test_lp64 "tls-large-desc-be"
250 run_dump_test "tls-tiny-ld"
251 run_dump_test "tls-small-ld"
252 run_dump_test_lp64 "tlsle"
253 run_dump_test "tlsle-symbol-offset"
254 run_dump_test "gc-got-relocs"
255 run_dump_test "gc-tls-relocs"
256 run_dump_test_lp64 "gc-plt-relocs"
257 run_dump_test_lp64 "gc-relocs-257-dyn"
258 run_dump_test_lp64 "gc-relocs-257"
259 run_dump_test "implicit_got_section_1"
260 run_dump_test "pr17415"
261 run_dump_test_lp64 "tprel_g2_overflow"
262 run_dump_test "tprel_add_lo12_overflow"
263 run_dump_test "protected-data"
266 run_dump_test "ifunc-1"
267 run_dump_test "ifunc-1-local"
268 run_dump_test "ifunc-2"
269 run_dump_test "ifunc-2-local"
270 run_dump_test "ifunc-3a"
271 run_dump_test "ifunc-3b"
272 run_dump_test "ifunc-4"
273 run_dump_test "ifunc-4a"
274 run_dump_test "ifunc-5a"
275 run_dump_test "ifunc-5b"
276 run_dump_test "ifunc-5a-local"
277 run_dump_test "ifunc-5b-local"
278 run_dump_test "ifunc-5r-local"
279 run_dump_test "ifunc-6a"
280 run_dump_test "ifunc-6b"
281 run_dump_test "ifunc-7a"
282 run_dump_test "ifunc-7b"
283 run_dump_test "ifunc-7c"
284 run_dump_test "ifunc-8"
285 run_dump_test_lp64 "ifunc-9"
286 run_dump_test_lp64 "ifunc-10"
287 run_dump_test_lp64 "ifunc-11"
288 run_dump_test_lp64 "ifunc-12"
289 run_dump_test_lp64 "ifunc-13"
290 run_dump_test "ifunc-14a"
291 run_dump_test "ifunc-14b"
292 run_dump_test "ifunc-14c"
293 run_dump_test "ifunc-14d"
294 run_dump_test "ifunc-14e"
295 run_dump_test "ifunc-14f"
296 run_dump_test "ifunc-15"
297 run_dump_test "ifunc-16"
298 run_dump_test "ifunc-17a"
299 run_dump_test "ifunc-17b"
300 run_dump_test_lp64 "ifunc-18a"
301 run_dump_test_lp64 "ifunc-18b"
302 run_dump_test_lp64 "ifunc-19a"
303 run_dump_test_lp64 "ifunc-19b"
304 run_dump_test_lp64 "ifunc-20"
305 run_dump_test_lp64 "ifunc-21"
306 run_dump_test_lp64 "ifunc-22"
308 run_dump_test "relasz"
309 run_dump_test_lp64 "relocs-1027-symbolic-func"
311 run_dump_test_lp64 "dt_textrel"
313 run_dump_test "plt_mapping_symbol"
315 run_dump_test_lp64 "rela-abs-relative"
316 run_dump_test_lp64 "rela-abs-relative-be"
317 run_dump_test_lp64 "rela-abs-relative-opt"
319 run_dump_test_lp64 "pie-bind-locally"
321 set aarch64elflinktests {
322 {"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
323 {} "copy-reloc-so.so"}
324 {"ld-aarch64/exe with copy relocation" "-e0 tmpdir/copy-reloc-so.so" "" ""
325 {copy-reloc-exe.s} {{objdump -R copy-reloc.d}} "copy-reloc"}
326 {"ld-aarch64/so with global func" "-shared" "" "" {func-in-so.s}
328 {"ld-aarch64/func sym hash opt for exe"
329 "-e0 --hash-style=gnu tmpdir/func-in-so.so" "" ""
330 {func-sym-hash-opt.s} {{readelf --dyn-sym func-sym-hash-opt.d}} "hash-opt"}
333 run_ld_link_tests $aarch64elflinktests