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