1# Expect script for various ARM ELF tests.
2#   Copyright (C) 2002-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
22if {[istarget "arm-*-vxworks"]} {
23    set armvxworkstests {
24	{"VxWorks shared library test 1" "-shared -Tvxworks1.ld" ""
25	 "" {vxworks1-lib.s}
26	 {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
27	  {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
28	 "libvxworks1.so"}
29	{"VxWorks executable test 1 (dynamic)" \
30	 "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" ""
31	 "" {vxworks1.s}
32	 {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
33	 "vxworks1"}
34	{"VxWorks executable test 2 (dynamic)" \
35	 "-Tvxworks1.ld -q --force-dynamic" ""
36	 "" {vxworks2.s}
37	 {{readelf --segments vxworks2.sd}}
38	 "vxworks2"}
39	{"VxWorks executable test 2 (static)"
40	 "-Tvxworks1.ld" ""
41	 "" {vxworks2.s}
42	 {{readelf --segments vxworks2-static.sd}}
43	 "vxworks2"}
44    }
45    run_ld_link_tests $armvxworkstests
46    run_dump_test "vxworks1-static"
47    run_dump_test "emit-relocs1-vxworks"
48}
49
50if { [istarget "arm*-*-symbianelf*"] } {
51    run_dump_test "symbian-seg1"
52}
53
54# Exclude non-ARM-ELF targets.
55
56if { ![is_elf_format] || ![istarget "arm*-*-*"] } {
57    return
58}
59
60# List contains test-items with 3 items followed by 2 lists and one more item:
61# 0:name 1:ld early options 2:ld late options 3:assembler options
62# 4:filenames of assembler files 5: action and options. 6: name of output file
63
64# Actions:
65# objdump: Apply objdump options on result.  Compare with regex (last arg).
66# nm: Apply nm options on result.  Compare with regex (last arg).
67# readelf: Apply readelf options on result.  Compare with regex (last arg).
68
69set armelftests_common_1 {
70    {"Group relocations" "-Ttext 0x8000 -Tdata 0x3000000 --section-start alpha=0xeef0 --section-start beta=0xffeef0" "" "" {group-relocs.s}
71     {{objdump -dr group-relocs.d}}
72     "group-relocs"}
73    {"Indirect cross-library function reference (set-up)"
74     "-shared" "" "" {arm-lib-plt-2a.s}
75     {}
76     "arm-lib-plt-2a.so"}
77    {"Indirect cross-library function reference"
78     "-shared tmpdir/arm-lib-plt-2a.so" "" "" {arm-lib-plt-2b.s}
79     {{objdump -dr arm-lib-plt-2.dd} {readelf --relocs arm-lib-plt-2.rd}}
80     "arm-lib-plt-2b.so"}
81    {"Simple static application" "" "" "" {arm-static-app.s}
82     {{objdump -fdw arm-static-app.d} {objdump -rw arm-static-app.r}}
83     "arm-static-app"}
84    {"target1-abs" "-static --target1-abs -T arm.ld" "" "" {arm-target1.s}
85     {{objdump -s arm-target1-abs.d}}
86     "arm-target1-abs"}
87    {"target1-rel" "-static --target1-rel -T arm.ld" "" "" {arm-target1.s}
88     {{objdump -s arm-target1-rel.d}}
89     "arm-target1-rel"}
90    {"target2-rel" "-static --target2=rel -T arm.ld" "" "" {arm-target2.s}
91     {{objdump -s arm-target2-rel.d}}
92     "arm-target2-rel"}
93    {"target2-abs" "-static --target2=abs -T arm.ld" "" "" {arm-target2.s}
94     {{objdump -s arm-target2-abs.d}}
95     "arm-target2-abs"}
96    {"target2-got-rel" "-static --target2=got-rel -T arm.ld" "" "" {arm-target2.s}
97     {{objdump -s arm-target2-got-rel.d}}
98     "arm-target2-got-rel"}
99    {"arm-rel31" "-static -T arm.ld" "" "" {arm-rel31.s}
100     {{objdump -s arm-rel31.d}}
101     "arm-rel31"}
102    {"arm-rel32" "-shared -T arm-dyn.ld" "" "" {arm-rel32.s}
103     {{objdump -Rsj.data arm-rel32.d}}
104     "arm-rel32"}
105    {"arm-call" "--no-fix-arm1176 -static -T arm.ld" "" "-meabi=4" {arm-call1.s arm-call2.s}
106     {{objdump -d arm-call.d}}
107     "arm-call"}
108    {"TLS shared library" "-shared -T arm-lib.ld" "" "" {tls-lib.s}
109     {{objdump -fdw tls-lib.d} {objdump -Rw tls-lib.r}}
110     "tls-lib.so"}
111    {"TLS dynamic application" "-T arm-dyn.ld tmpdir/tls-lib.so" "" "" {tls-app.s}
112     {{objdump -fdw tls-app.d} {objdump -Rw tls-app.r}}
113     "tls-app"}
114    {"TLS gnu shared library got" "-shared -T arm-dyn.ld" "" "" {tls-gdesc-got.s}
115     {{objdump "-fDR -j .got" tls-gdesc-got.d}}
116     "tls-lib2-got.so"}
117    {"TLS gnu GD to IE relaxation" "-static -T arm-dyn.ld" "" "" {tls-gdierelax.s}
118     {{objdump -fdw tls-gdierelax.d}}
119     "tls-app-rel-ie"}
120    {"TLS gnu GD to IE shared relaxation" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-gdierelax2.s}
121     {{objdump -fdw tls-gdierelax2.d}}
122     "tls-app-rel-ie2"}
123    {"TLS gnu GD to LE relaxation" "-T arm-dyn.ld" "" "" {tls-gdlerelax.s}
124     {{objdump -fdw tls-gdlerelax.d}}
125     "tls-app-rel-le"}
126    {"TLS mixed models shared lib" "-shared -T arm-dyn.ld" "" "" {tls-mixed.s}
127     {{objdump -Rw tls-mixed.r}}
128     "tls-mixed.so"}
129    {"TLS descseq relaxation" "-T arm-dyn.ld" "" "" {tls-descrelax.s}
130     {{objdump -fdw tls-descrelax.d}}
131     "tls-descrelax"}
132    {"TLS descseq relaxation v7" "-T arm-dyn.ld" "" "" {tls-descrelax-v7.s}
133     {{objdump -fdw tls-descrelax-v7.d}}
134     "tls-descrelax-v7"}
135    {"TLS descseq relaxation BE8" "-T arm-dyn.ld -EB --be8" "" "-mbig-endian" {tls-descrelax-be8.s}
136     {{objdump -fdw tls-descrelax-be8.d}}
137     "tls-descrelax-be8"}
138    {"TLS descseq relaxation BE32" "-T arm-dyn.ld -EB" "" "-mbig-endian" {tls-descrelax-be32.s}
139     {{objdump -fdw tls-descrelax-be32.d}}
140     "tls-descrelax-be32"}
141    {"TLS local PIC symbol static link" "-T arm.ld" "" "" {tls-local-static.s}
142      {{objdump -fdw tls-local-static.d}}
143      "tls-local-static"}
144    {"MOVW/MOVT" "-static -T arm.ld" "" "" {arm-movwt.s}
145     {{objdump -dw arm-movwt.d}}
146     "arm-movwt"}
147    {"BE8 Mapping Symbols" "-static -T arm.ld -EB --be8" "" "-EB" {arm-be8.s}
148     {{objdump -d arm-be8.d}}
149     "arm-be8"}
150    {"VFP11 denorm erratum fix, scalar operation"
151     "-EL --vfp11-denorm-fix=scalar -Ttext=0x8000" "" "-EL -mfpu=vfpxd" {vfp11-fix-scalar.s}
152     {{objdump -dr vfp11-fix-scalar.d}}
153     "vfp11-fix-scalar"}
154    {"VFP11 denorm erratum fix, vector operation"
155     "-EB --vfp11-denorm-fix=vector -Ttext=0x8000" "" "-EB -mfpu=vfpxd" {vfp11-fix-vector.s}
156     {{objdump -dr vfp11-fix-vector.d}}
157     "vfp11-fix-vector"}
158    {"VFP11 denorm erratum fix, embedded code-like data"
159     "-EL --vfp11-denorm-fix=scalar -Ttext=0x8000" "" "-EL -mfpu=vfpxd" {vfp11-fix-none.s}
160     {{objdump -dr vfp11-fix-none.d}}
161     "vfp11-fix-none"}
162    {"STM32L4XX erratum fix LDM"
163     "-EL --fix-stm32l4xx-629360 -Ttext=0x8000" "" "-EL -mcpu=cortex-m4 -mfpu=fpv4-sp-d16" {stm32l4xx-fix-ldm.s}
164     {{objdump -dr stm32l4xx-fix-ldm.d}}
165     "stm32l4xx-fix-ldm"}
166    {"STM32L4XX erratum fix VLDM"
167     "-EL --fix-stm32l4xx-629360 -Ttext=0x8000" "" "-EL -mcpu=cortex-m4 -mfpu=fpv4-sp-d16" {stm32l4xx-fix-vldm.s}
168     {{objdump -dr stm32l4xx-fix-vldm.d}}
169     "stm32l4xx-fix-vldm"}
170    {"STM32L4XX erratum fix VLDM, DP registers"
171     "-EL --fix-stm32l4xx-629360 -Ttext=0x8000" "" "-EL -mcpu=cortex-m4 -mfpu=fpv4-sp-d16" {stm32l4xx-fix-vldm-dp.s}
172     {{objdump -dr stm32l4xx-fix-vldm-dp.d}}
173     "stm32l4xx-fix-vldm-dp"}
174    {"STM32L4XX erratum fix ALL"
175     "-EL --fix-stm32l4xx-629360=all -Ttext=0x8000" "" "-EL -mcpu=cortex-m4 -mfpu=fpv4-sp-d16" {stm32l4xx-fix-all.s}
176     {{objdump -dr stm32l4xx-fix-all.d}}
177     "stm32l4xx-fix-all"}
178    {"STM32L4XX erratum fix in IT context"
179     "-EL --fix-stm32l4xx-629360 -Ttext=0x8000" "" "-EL -mcpu=cortex-m4 -mfpu=fpv4-sp-d16" {stm32l4xx-fix-it-block.s}
180     {{objdump -dr stm32l4xx-fix-it-block.d}}
181     "stm32l4xx-fix-it-block"}
182    {"Unwinding and -gc-sections" "-gc-sections" "" "" {gc-unwind.s}
183     {{objdump -sj.data gc-unwind.d}}
184	"gc-unwind"}
185}
186
187set armelftests_common_2 {
188    {"script-type" "-static -T script-type.ld" "" "" {script-type.s}
189	{{readelf -s script-type.sym}}
190	"script-type"}
191}
192
193set armelftests_common_3 {
194    {"callweak" "-static -T arm.ld" "" "" {callweak.s}
195     {{objdump -dr callweak.d}}
196     "callweak"}
197    {"Relocation boundaries" "-defsym x=0 -defsym y=0 -defsym _start=0" "" "" {reloc-boundaries.s}
198     {{objdump -s reloc-boundaries.d}}
199     "reloc-boundaries"}
200    {"Data only mapping symbols" "-T data-only-map.ld -Map map" "" "" {data-only-map.s}
201     {{objdump -dr data-only-map.d}}
202     "data-only-map"}
203    {"Data only mapping symbols for merged sections" "-T rodata-merge-map.ld" "" "" {rodata-merge-map1.s rodata-merge-map2.s rodata-merge-map3.s}
204     {{readelf -s rodata-merge-map.sym}}
205     "rodata-merge-map"}
206    {"GOT relocations in executables (setup)" "-shared" ""
207     "" {exec-got-1a.s}
208     {}
209     "exec-got-1.so"}
210    {"GOT relocations in executables" "tmpdir/exec-got-1.so" ""
211     "" {exec-got-1b.s}
212     {{readelf --relocs exec-got-1.d}}
213     "exec-got-1"}
214    {"Simple non-PIC shared library (no PLT check)" "-shared" "" "" {arm-lib.s}
215     {{objdump -Rw arm-lib.r}}
216     "arm-lib.so"}
217    {"EABI soft-float ET_EXEC ABI flag" "-T arm.ld" "" "-mfloat-abi=soft -meabi=5" {eabi-soft-float.s}
218     {{readelf -h eabi-soft-float.d}}
219     "eabi-soft-float"}
220    {"EABI hard-float ET_EXEC ABI flag" "-T arm.ld" "" "-mfloat-abi=hard -meabi=5" {eabi-hard-float.s}
221     {{readelf -h eabi-hard-float.d}}
222     "eabi-hard-float"}
223    {"EABI hard-float ET_DYN ABI flag" "-shared" "" "-mfloat-abi=hard -meabi=5" {eabi-hard-float.s}
224     {{readelf -h eabi-hard-float.d}}
225     "eabi-hard-float.so"}
226    {"EABI ABI flags wrong ABI version" "-T arm.ld" "" "-mfloat-abi=soft -meabi=4" {eabi-soft-float.s}
227     {{readelf -h eabi-soft-float-ABI4.d}}
228     "eabi-soft-float-no-flags"}
229    {"EABI ABI flags ld -r" "-r" "" "-mfloat-abi=soft -meabi=5" {eabi-soft-float.s}
230     {{readelf -h eabi-soft-float-r.d}}
231     "eabi-soft-float-r.o"}
232    {"PC-relative in -shared" "-shared" ""
233     "" {pcrel-shared.s}
234     {{readelf -dr pcrel-shared.rd}}
235     "pcrel-shared.so"}
236    {"MOVS thumb1 relocations" "-static -T arm.ld" "" "" {thumb1-movs.s}
237     {{objdump -dw thumb1-movs.d}}
238     "thumb1-movs"}
239    {"ADDS thumb1 relocations" "-static -T arm.ld" "" "" {thumb1-adds.s}
240     {{objdump -dw thumb1-adds.d}}
241     "thumb1-adds"}
242    {"MOVS thumb1 relocations for armv7-m target" "-static -T arm.ld" "" "" {thumb1-movs-armv7-m.s}
243     {{objdump -dw thumb1-movs.d}}
244     "thumb1-movs"}
245    {"ADDS thumb1 relocations for armv7-m target" "-static -T arm.ld" "" "" {thumb1-adds-armv7-m.s}
246     {{objdump -dw thumb1-adds.d}}
247     "thumb1-adds"}
248}
249
250run_ld_link_tests $armelftests_common_1
251if { ![istarget "arm*-*-netbsdelf"] } {
252    run_ld_link_tests $armelftests_common_2
253}
254run_ld_link_tests $armelftests_common_3
255
256
257set armelftests_nonacl {
258    {"Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x401000" "" "" {thumb1-bl.s}
259     {{objdump -dr thumb1-bl.d}}
260     "thumb1-bl"}
261    {"Thumb entry point" "-T arm.ld" "" "" {thumb-entry.s}
262     {{readelf -h thumb-entry.d}}
263     "thumb-entry"}
264    {"thumb-rel32" "-static -T arm.ld" "" "" {thumb-rel32.s}
265     {{objdump -s thumb-rel32.d}}
266     "thumb-rel32"}
267    {"jump19" "-static -T arm.ld" "" "" {jump19.s}
268     {{objdump -dr jump19.d}}
269     "jump19"}
270    {"Thumb and -gc-sections" "-shared -T arm-dyn.ld" "" "" {gc-thumb-lib.s}
271     {}
272     "gc-thumb-lib.so"}
273    {"Thumb and -gc-sections" "-pie -T arm.ld -gc-sections tmpdir/gc-thumb-lib.so" "" "" {gc-thumb.s}
274     {{readelf --relocs gc-thumb.d}}
275     "gc-thumb"}
276
277    {"Simple non-PIC shared library" "-shared" "" "" {arm-lib.s}
278     {{objdump -fdw arm-lib.d} {objdump -Rw arm-lib.r}}
279     "arm-lib.so"}
280    {"Simple PIC shared library" "-shared" "" "" {arm-lib-plt32.s}
281     {{objdump -fdw arm-lib-plt32.d} {objdump -Rw arm-lib-plt32.r}}
282     "arm-lib-plt32.so"}
283    {"Simple dynamic application" "tmpdir/arm-lib.so" "" "" {arm-app.s}
284     {{objdump -fdw arm-app.d} {objdump -Rw arm-app.r}}
285     "arm-app"}
286    {"Simple static application without .rel.plt in linker script"
287	"-T arm-no-rel-plt.ld" "" "" {arm-static-app.s}
288     {{objdump -fdw arm-static-app.d} {objdump -rw arm-static-app.r}}
289     "arm-static-app-no-rel-plt"}
290    {"Simple dynamic application without .rel.plt in linker script"
291	"tmpdir/arm-lib.so -T arm-no-rel-plt.ld" "" "" {arm-app.s}
292     {{readelf -dr arm-no-rel-plt.r}}
293     "arm-app-no-rel-plt"}
294    {"Non-pcrel function reference" "tmpdir/arm-lib.so" "" "" {arm-app-abs32.s}
295     {{objdump -fdw arm-app-abs32.d} {objdump -Rw arm-app-abs32.r}}
296     "arm-app-abs32"}
297    {"Thumb shared library with ARM entry points" "-shared -T arm-lib.ld" "" "-mthumb-interwork"
298     {mixed-lib.s}
299     {{objdump -fdw armthumb-lib.d} {readelf -Ds armthumb-lib.sym}}
300     "armthumb-lib.so"}
301    {"Mixed ARM/Thumb shared library" "-shared -T arm-lib.ld -use-blx" "" ""
302     {mixed-lib.s}
303     {{objdump -fdw mixed-lib.d} {objdump -Rw mixed-lib.r}
304      {readelf -Ds mixed-lib.sym}}
305     "mixed-lib.so"}
306    {"Mixed ARM/Thumb dynamic application" "tmpdir/mixed-lib.so -T arm-dyn.ld" "" ""
307     {mixed-app.s}
308     {{objdump -fdw mixed-app.d} {objdump -Rw mixed-app.r}
309      {readelf -Ds mixed-app.sym}}
310     "mixed-app"}
311    {"Mixed ARM/Thumb arch5 dynamic application" "tmpdir/mixed-lib.so -T arm-dyn.ld --use-blx" "" ""
312     {mixed-app.s}
313     {{objdump -fdw mixed-app-v5.d} {objdump -Rw mixed-app.r}
314      {readelf -Ds mixed-app.sym}}
315     "mixed-app-v5"}
316    {"Using Thumb lib by another lib" "-shared tmpdir/mixed-lib.so" "" "" {use-thumb-lib.s}
317     {{readelf -Ds use-thumb-lib.sym}}
318     "use-thumb-lib.so"}
319    {"TLS gnu shared library inlined trampoline" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-descseq.s}
320     {{objdump -fdw tls-descseq.d} {objdump -Rw tls-descseq.r}}
321     "tls-lib2inline.so"}
322    {"TLS shared library gdesc local" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-lib-loc.s}
323     {{objdump -fdw tls-lib-loc.d} {objdump -Rw tls-lib-loc.r}}
324     "tls-lib-loc.so"}
325}
326
327if { ![istarget "arm*-*-nacl*"] } {
328    run_ld_link_tests $armelftests_nonacl
329}
330
331run_dump_test "group-relocs-alu-bad"
332run_dump_test "group-relocs-alu-bad-2"
333run_dump_test "group-relocs-ldr-bad"
334run_dump_test "group-relocs-ldr-bad-2"
335run_dump_test "group-relocs-ldrs-bad"
336run_dump_test "group-relocs-ldrs-bad-2"
337run_dump_test "group-relocs-ldc-bad"
338run_dump_test "group-relocs-ldc-bad-2"
339run_dump_test "thumb2-bl-undefweak"
340run_dump_test "thumb2-bl-undefweak1"
341run_dump_test "emit-relocs1"
342run_dump_test "movw-shared-1"
343run_dump_test "movw-shared-2"
344run_dump_test "movw-shared-3"
345run_dump_test "movw-shared-4"
346run_dump_test "rel32-reject"
347run_dump_test "rel32-reject-pie"
348
349# Exclude non-ARM-EABI targets.
350
351if { [istarget "arm*-*-netbsdelf"] } {
352    return
353}
354
355if { ![istarget "arm*-*-*eabi*"] && ![istarget "arm*-*-nacl*"] } {
356    # Special variants of these tests, as a different farcall stub is
357    # generated for a non-ARM-EABI target: indeed in such a case,
358    # there are no attributes to indicate that blx can be used.
359
360    set arm_noeabi_tests {
361	{"Thumb-2-as-Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-as-thumb1-bad.s}
362	    {{objdump -d thumb2-bl-as-thumb1-bad-noeabi.d}}
363	    "thumb2-bl-as-thumb1-bad"}
364	{"Thumb-2 BL bad" "-Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-bad.s}
365	    {{objdump -d thumb2-bl-bad-noeabi.d}}
366	    "thumb2-bl-bad"}
367    }
368    run_ld_link_tests $arm_noeabi_tests
369
370    return
371}
372
373# Farcalls stubs are fully supported for ARM-EABI only.
374# This list is massaged below into run_ld_link_tests standard format.
375# The source list is almost that same format.  The one difference is
376# that each "action" (elements of element 5) might have four elements
377# instead of three; in that case, the fourth element is the name of
378# the dump file to use for arm*-*nacl* targets instead of the canonical
379# dump file (the third element).
380set armeabitests_common {
381     {"EABI attribute merging" "-r" "" "" {attr-merge.s attr-merge.s}
382      {{readelf -A attr-merge.attr}}
383      "attr-merge"}
384     {"EABI attribute merging 2" "-r" "" "" {attr-merge-2a.s attr-merge-2b.s}
385      {{readelf -A attr-merge-2.attr}}
386      "attr-merge-2"}
387     {"EABI attribute merging 3" "-r" "" "" {attr-merge-3a.s attr-merge-3b.s}
388      {{readelf -A attr-merge-3.attr}}
389      "attr-merge-3"}
390     {"EABI attribute merging 4" "-r" "" "" {attr-merge-4a.s attr-merge-4b.s}
391      {{readelf -A attr-merge-4.attr}}
392      "attr-merge-4"}
393     {"EABI attribute merging 5" "-r" "" "" {attr-merge-5.s attr-merge-5.s}
394      {{readelf -A attr-merge-5.attr}}
395      "attr-merge-5"}
396     {"EABI attribute merging 6" "-r" "" "" {attr-merge-6a.s attr-merge-6b.s}
397      {{readelf -A attr-merge-6.attr}}
398      "attr-merge-6"}
399     {"EABI attribute merging 6 reversed" "-r" "" "" {attr-merge-6b.s attr-merge-6a.s}
400      {{readelf -A attr-merge-6.attr}}
401      "attr-merge-6r"}
402     {"EABI attribute merging 7" "-r" "" "" {attr-merge-7a.s attr-merge-7b.s}
403      {{readelf -A attr-merge-7.attr}}
404      "attr-merge-7"}
405     {"EABI attribute merging 8" "-r" "" "" {attr-merge-8a.s attr-merge-8b.s}
406      {{readelf -A attr-merge-8.attr}}
407      "attr-merge-8"}
408     {"EABI attribute merging 9" "-r" "" "" {attr-merge-9a.s attr-merge-9b.s}
409      {{ld attr-merge-9.out}}
410      "attr-merge-9"}
411     {"EABI attribute merging 10" "-r" "" "" {attr-merge-10a.s attr-merge-10b.s}
412      {{readelf -A attr-merge-10.attr}}
413      "attr-merge-10"}
414     {"EABI attribute merging 10 (DSP)" "-r" "" "" {attr-merge-10a.s attr-merge-10b-dsp.s}
415      {{readelf -A attr-merge-10-dsp.attr}}
416      "attr-merge-10-dsp"}
417     {"EABI attribute arch merging 1" "-r" "" "" {arch-v6k.s arch-v6t2.s}
418      {{readelf -A attr-merge-arch-1.attr}}
419      "attr-merge-arch-1"}
420     {"EABI attribute arch merging 1 reversed" "-r" "" "" {arch-v6t2.s arch-v6k.s}
421      {{readelf -A attr-merge-arch-1.attr}}
422      "attr-merge-arch-1r"}
423     {"EABI attribute arch merging 2" "-r" "" "" {arch-v6k.s arch-v6.s}
424      {{readelf -A attr-merge-arch-2.attr}}
425      "attr-merge-arch-2"}
426     {"EABI attribute arch merging 2 reversed" "-r" "" "" {arch-v6.s arch-v6k.s}
427      {{readelf -A attr-merge-arch-2.attr}}
428      "attr-merge-arch-2r"}
429    {"MOVW/MOVT and merged sections" "-T arm.ld" "" "" {movw-merge.s}
430     {{objdump -dw movw-merge.d}}
431     "movw-merge"}
432    {"MOVW/MOVT against shared libraries" "tmpdir/arm-lib.so" "" "" {arm-app-movw.s}
433     {{objdump -Rw arm-app.r}}
434     "arm-app-movw"}
435
436    {"ARM-ARM farcall" "-Ttext 0x1000 --section-start .foo=0x2001020" "" "" {farcall-arm-arm.s}
437     {{objdump -d farcall-arm-arm.d farcall-arm-nacl.d}}
438     "farcall-arm-arm"}
439    {"ARM-ARM farcall (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001020 --pic-veneer" "" "" {farcall-arm-arm.s}
440     {{objdump -d farcall-arm-arm-pic-veneer.d farcall-arm-nacl-pic.d}}
441     "farcall-arm-arm-pic-veneer"}
442    {"ARM-ARM farcall (BE8)" "-Ttext 0x1000 --section-start .foo=0x2001020 -EB --be8" "" "-EB" {farcall-arm-arm.s}
443     {{objdump -d farcall-arm-arm.d farcall-arm-nacl.d}}
444     "farcall-arm-arm-be8"}
445    {"ARM-ARM farcall (BE)" "-Ttext 0x1000 --section-start .foo=0x2001020 -EB" "" "-EB" {farcall-arm-arm.s}
446     {{objdump -d farcall-arm-arm.d farcall-arm-nacl.d}}
447     "farcall-arm-arm-be"}
448
449    {"Long branch with mixed text and data" "-T arm.ld" "" "" {farcall-data.s}
450     {{objdump -dr farcall-data.d farcall-data-nacl.d}}
451     "farcall-data"}
452    {"callweak-2" "-static -T arm.ld" "" "" {callweak-2.s}
453     {{objdump -dr callweak-2.d}}
454     "callweak-2"}
455    {"abs call" "-T arm.ld" "" "" {abs-call-1.s}
456     {{objdump -d abs-call-1.d}}
457     "abs-call-1"}
458}
459
460set armeabitests_nonacl {
461    {"ARM-Thumb farcall" "-Ttext 0x1000 --section-start .foo=0x2001014" "" "" {farcall-arm-thumb.s}
462     {{objdump -d farcall-arm-thumb.d}}
463     "farcall-arm-thumb"}
464    {"ARM-Thumb farcall with BLX" "--no-fix-arm1176 -Ttext 0x1000 --section-start .foo=0x2001014" "" "-march=armv5t" {farcall-arm-thumb.s}
465     {{objdump -d farcall-arm-thumb-blx.d}}
466     "farcall-arm-thumb-blx"}
467    {"ARM-Thumb farcall (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "" "" {farcall-arm-thumb.s}
468     {{objdump -d farcall-arm-thumb-pic-veneer.d}}
469     "farcall-arm-thumb-pic-veneer"}
470    {"ARM-Thumb farcall with BLX (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "" "-march=armv5t" {farcall-arm-thumb.s}
471     {{objdump -d farcall-arm-thumb-blx-pic-veneer.d}}
472     "farcall-arm-thumb-blx-pic-veneer"}
473
474    {"Thumb-Thumb farcall with BLX" "--no-fix-arm1176 -Ttext 0x1000 --section-start .foo=0x2001014" "" "-march=armv5t" {farcall-thumb-thumb.s}
475     {{objdump -d farcall-thumb-thumb-blx.d}}
476     "farcall-thumb-thumb-blx"}
477    {"Thumb-Thumb farcall M profile" "-Ttext 0x1000 --section-start .foo=0x2001014" "" "-march=armv6-m" {farcall-thumb-thumb.s}
478     {{objdump -d farcall-thumb-thumb-m.d}}
479     "farcall-thumb-thumb-m"}
480    {"Thumb2-Thumb2 farcall M profile" "-Ttext 0x1000 --section-start .foo=0x2001014" "" "-march=armv7-m" {farcall-thumb-thumb.s}
481     {{objdump -d farcall-thumb2-thumb2-m.d}}
482     "farcall-thumb2-thumb2-m"}
483    {"Thumb-Thumb farcall v8-M Baseline" "-Ttext 0x1000 --section-start .foo=0x2001014" "" "-march=armv8-m.base" {farcall-thumb-thumb.s}
484     {{objdump -d farcall-thumb-thumb-m.d}}
485     "farcall-thumb-thumb-v8-m-base"}
486    {"Thumb-Thumb farcall v8-M Mainline" "-Ttext 0x1000 --section-start .foo=0x2001014" "" "-march=armv8-m.main" {farcall-thumb-thumb.s}
487     {{objdump -d farcall-thumb-thumb-m.d}}
488     "farcall-thumb-thumb-v8-m-main"}
489    {"Thumb-Thumb farcall v6-M" "-Ttext 0x1000 --section-start .foo=0x2001014" "" "-march=armv6-m" {farcall-thumb-thumb.s}
490     {{objdump -d farcall-thumb-thumb-m.d}}
491     "farcall-thumb-thumb-v6-m"}
492    {"Thumb-Thumb farcall" "-Ttext 0x1000 --section-start .foo=0x2001014" "" "-march=armv4t" {farcall-thumb-thumb.s}
493     {{objdump -d farcall-thumb-thumb.d}}
494     "farcall-thumb-thumb"}
495    {"Thumb-Thumb farcall with BLX (PIC veneer)" "--no-fix-arm1176 -Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "" "-march=armv5t" {farcall-thumb-thumb.s}
496     {{objdump -d farcall-thumb-thumb-blx-pic-veneer.d}}
497     "farcall-thumb-thumb-blx-pic-veneer"}
498    {"Thumb-Thumb farcall M profile (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "" "-march=armv7-m" {farcall-thumb-thumb.s}
499     {{objdump -d farcall-thumb-thumb-m-pic-veneer.d}}
500     "farcall-thumb-thumb-m-pic-veneer"}
501    {"Thumb-Thumb farcall (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "" "-march=armv4t" {farcall-thumb-thumb.s}
502     {{objdump -d farcall-thumb-thumb-pic-veneer.d}}
503     "farcall-thumb-thumb-pic-veneer"}
504    {"Thumb-Thumb farcall v6-M (no profile)" "-Ttext 0x1000 --section-start .foo=0x2001014" "" ""
505     {farcall-thumb-thumb-m-no-profile-a.s farcall-thumb-thumb-m-no-profile-b.s}
506     {{objdump -d farcall-thumb-thumb-m-no-profile.d}}
507     "farcall-thumb-thumb-m-no-profile"}
508
509    {"Thumb-ARM farcall" "-Ttext 0x1c01010 --section-start .foo=0x2001014" "" "-W" {farcall-thumb-arm.s}
510     {{objdump -d farcall-thumb-arm.d}}
511     "farcall-thumb-arm"}
512    {"Thumb-ARM farcall (BE8)" "-Ttext 0x1c01010 --section-start .foo=0x2001014 -EB --be8" "" "-W -EB" {farcall-thumb-arm.s}
513     {{objdump -d farcall-thumb-arm.d}}
514     "farcall-thumb-arm-be8"}
515    {"Thumb-ARM farcall (BE)" "-Ttext 0x1c01010 --section-start .foo=0x2001014 -EB" "" "-W -EB" {farcall-thumb-arm.s}
516     {{objdump -d farcall-thumb-arm.d}}
517     "farcall-thumb-arm-be"}
518    {"Thumb-ARM (short) call" "-Ttext 0x1000 --section-start .foo=0x0002014" "" "-W" {farcall-thumb-arm-short.s}
519     {{objdump -d farcall-thumb-arm-short.d}}
520     "farcall-thumb-arm-short"}
521    {"Thumb-ARM farcall with BLX" "--no-fix-arm1176 -Ttext 0x1c01010 --section-start .foo=0x2001014" "" "-W -march=armv5t" {farcall-thumb-arm.s}
522     {{objdump -d farcall-thumb-arm-blx.d}}
523     "farcall-thumb-arm-blx"}
524    {"Thumb-ARM farcall with BLX (PIC veneer)" "--no-fix-arm1176 -Ttext 0x1c01010 --section-start .foo=0x2001014 --pic-veneer" "" "-W -march=armv5t" {farcall-thumb-arm.s}
525     {{objdump -d farcall-thumb-arm-blx-pic-veneer.d}}
526     "farcall-thumb-arm-blx-pic-veneer"}
527    {"Thumb-ARM farcall (PIC veneer)" "-Ttext 0x1c01010 --section-start .foo=0x2001014 --pic-veneer" "" "-W" {farcall-thumb-arm.s}
528     {{objdump -d farcall-thumb-arm-pic-veneer.d}}
529     "farcall-thumb-arm-pic-veneer"}
530
531    {"Thumb-ARM farcall cond" "-Ttext 0x8000 --section-start .foo=0x118000" "" "-W" {farcall-cond-thumb-arm.s}
532     {{objdump -d farcall-cond-thumb-arm.d}}
533     "farcall-cond-thumb-arm"}
534    {"Thumb-ARM farcall cond (BE8)" "-Ttext 0x8000 --section-start .foo=0x118000 -EB --be8" "" "-W -EB" {farcall-cond-thumb-arm.s}
535     {{objdump -d farcall-cond-thumb-arm.d}}
536     "farcall-cond-thumb-arm-be8"}
537    {"Thumb-ARM farcall cond (BE)" "-Ttext 0x8000 --section-start .foo=0x118000 -EB" "" "-W -EB" {farcall-cond-thumb-arm.s}
538     {{objdump -d farcall-cond-thumb-arm.d}}
539     "farcall-cond-thumb-arm-be"}
540
541    {"Multiple farcalls" "-Ttext 0x1000 --section-start .foo=0x2002020" "" "" {farcall-mix.s}
542     {{objdump -d farcall-mix.d}}
543     "farcall-mix"}
544    {"Multiple farcalls from several sections" "-Ttext 0x1000 --section-start .mytext=0x2000 --section-start .foo=0x2003020" "" "" {farcall-mix2.s}
545     {{objdump -d farcall-mix2.d}}
546     "farcall-mix2"}
547
548    {"Mixed ARM/Thumb dynamic application with farcalls" "tmpdir/mixed-lib.so -T arm-dyn.ld --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" ""
549     {farcall-mixed-app.s}
550     {{objdump -fdw farcall-mixed-app.d} {objdump -Rw farcall-mixed-app.r}
551      {readelf -Ds farcall-mixed-app.sym}}
552     "farcall-mixed-app"}
553    {"Mixed ARM/Thumb arch5 dynamic application with farcalls" "tmpdir/mixed-lib.so -T arm-dyn.ld --use-blx --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" ""
554     {farcall-mixed-app.s}
555     {{objdump -fdw farcall-mixed-app-v5.d} {objdump -Rw farcall-mixed-app.r}
556      {readelf -Ds farcall-mixed-app.sym}}
557     "farcall-mixed-app-v5"}
558
559    {"Mixed ARM/Thumb2 dynamic application with farcalls" "tmpdir/mixed-lib.so -T arm-dyn.ld --section-start .mid_thumb=0x10081c0 --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" ""
560     {farcall-mixed-app2.s}
561     {{objdump -fdw farcall-mixed-app2.d} {objdump -Rw farcall-mixed-app2.r}
562      {readelf -Ds farcall-mixed-app2.sym}}
563     "farcall-mixed-app2"}
564
565    {"Mixed ARM/Thumb shared library with long branches (v4t)" "-shared -T arm-lib.ld" "" "-march=armv4t"
566     {farcall-mixed-lib1.s farcall-mixed-lib2.s}
567     {{objdump -fdw farcall-mixed-lib-v4t.d}}
568     "farcall-mixed-lib.so"}
569
570    {"Mixed ARM/Thumb shared library with long branches (v5t)" "--no-fix-arm1176 -shared -T arm-lib.ld" "" "-march=armv5t"
571     {farcall-mixed-lib1.s farcall-mixed-lib2.s}
572     {{objdump -fdw farcall-mixed-lib.d}}
573     "farcall-mixed-lib.so"}
574
575    {"Thumb-2-as-Thumb-1 BL" "--no-fix-arm1176 -Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-as-thumb1-bad.s}
576     {{objdump -d thumb2-bl-as-thumb1-bad.d}}
577     "thumb2-bl-as-thumb1-bad"}
578    {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-bad.s}
579     {{objdump -d thumb2-bl-bad.d}}
580     "thumb2-bl-bad"}
581    {"Branch to linker script symbol with BL for thumb-only target" "-T branch-lks-sym.ld" "" "" {thumb-bl-lks-sym.s}
582     {{objdump -d thumb-bl-lks-sym.d}}
583     "thumb-bl-lks-sym"}
584    {"Branch to linker script symbol with B for thumb-only target" "-T branch-lks-sym.ld" "" "" {thumb-b-lks-sym.s}
585     {{objdump -d thumb-b-lks-sym.d}}
586     "thumb-b-lks-sym"}
587
588    {"erratum 760522 fix (default for v6z)" "--section-start=.foo=0x2001014" ""
589     "-march=armv6z" {fix-arm1176.s}
590     {{objdump -d fix-arm1176-on.d}}
591     "fix-arm1176-1"}
592    {"erratum 760522 fix (explicitly on at v6z)" "--section-start=.foo=0x2001014 --fix-arm1176" ""
593     "-march=armv6z" {fix-arm1176.s}
594     {{objdump -d fix-arm1176-on.d}}
595     "fix-arm1176-2"}
596    {"erratum 760522 fix (explicitly off at v6z)" "--section-start=.foo=0x2001014 --no-fix-arm1176" ""
597     "-march=armv6z" {fix-arm1176.s}
598     {{objdump -d fix-arm1176-off.d}}
599     "fix-arm1176-3"}
600    {"erratum 760522 fix (default for v5)" "--section-start=.foo=0x2001014 " ""
601     "-march=armv5te" {fix-arm1176.s}
602     {{objdump -d fix-arm1176-on.d}}
603     "fix-arm1176-4"}
604    {"erratum 760522 fix (default for v7-a)" "--section-start=.foo=0x2001014 " ""
605     "-march=armv7-a" {fix-arm1176.s}
606     {{objdump -d fix-arm1176-off.d}}
607     "fix-arm1176-5"}
608    {"erratum 760522 fix (default for ARM1156)" "--section-start=.foo=0x2001014 " ""
609     "-mcpu=arm1156t2f-s" {fix-arm1176.s}
610     {{objdump -d fix-arm1176-off.d}}
611     "fix-arm1176-6"}
612
613     {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x1001000" "" "" {thumb2-bl.s}
614      {{objdump -dr thumb2-bl.d}}
615      "thumb2-bl"}
616    {"Thumb-2 Interworked branch" "-T arm.ld" "" "" {thumb2-b-interwork.s}
617      {{objdump -dr thumb2-b-interwork.d}}
618      "thumb2-b-interwork"}
619    {"BL/BLX interworking" "-T arm.ld" "" "" {thumb2-bl-blx-interwork.s}
620     {{objdump -dr thumb2-bl-blx-interwork.d}}
621     "thumb2-bl-blx-interwork"}
622    {"ARMv4 interworking" "-static -T arm.ld --fix-v4bx-interworking" "" "--fix-v4bx -meabi=4" {armv4-bx.s}
623     {{objdump -d armv4-bx.d}}
624     "armv4-bx"}
625
626    {"R_ARM_THM_JUMP24 Relocation veneers: Short 1"
627     "--no-fix-arm1176 --section-start destsect=0x00009000 --section-start .text=0x8000" ""
628     "-march=armv7-a -mthumb"
629     {jump-reloc-veneers.s}
630     {{objdump -d jump-reloc-veneers-short1.d}}
631     "jump-reloc-veneers-short1"}
632    {"R_ARM_THM_JUMP24 Relocation veneers: Short 2"
633     "--no-fix-arm1176 --section-start destsect=0x00900000 --section-start .text=0x8000" ""
634     "-march=armv7-a -mthumb"
635     {jump-reloc-veneers.s}
636     {{objdump -d jump-reloc-veneers-short2.d}}
637     "jump-reloc-veneers-short2"}
638    {"R_ARM_THM_JUMP24 Relocation veneers: Long"
639     "--no-fix-arm1176 --section-start destsect=0x09000000 --section-start .text=0x8000" ""
640     "-march=armv7-a -mthumb"
641     {jump-reloc-veneers.s}
642     {{objdump -d jump-reloc-veneers-long.d}}
643     "jump-reloc-veneers-long"}
644
645    {"R_ARM_THM_JUMP19 Relocation veneers: Short"
646     "--section-start destsect=0x000108002 --section-start .text=0x8000" ""
647     "-march=armv7-m -mthumb"
648     {jump-reloc-veneers-cond.s}
649     {{objdump -d jump-reloc-veneers-cond-short.d}}
650     "jump-reloc-veneers-cond-short"}
651    {"R_ARM_THM_JUMP19 Relocation veneers: Long"
652     "--section-start destsect=0x00108004 --section-start .text=0x8000" ""
653     "-march=armv7-m -mthumb"
654     {jump-reloc-veneers-cond.s}
655     {{objdump -d jump-reloc-veneers-cond-long.d}}
656     "jump-reloc-veneers-cond-long"}
657    {"R_ARM_THM_JUMP19 Relocation veneers: Short backward"
658     "--section-start destsect=0x8004 --section-start .text=0x108000" ""
659     "-march=armv7-m -mthumb"
660     {jump-reloc-veneers-cond.s}
661     {{objdump -d jump-reloc-veneers-cond-short-backward.d}}
662     "jump-reloc-veneers-cond-short-backward"}
663    {"R_ARM_THM_JUMP19 Relocation veneers: Long backward"
664     "--section-start destsect=0x8002 --section-start .text=0x108000" ""
665     "-march=armv7-m -mthumb"
666     {jump-reloc-veneers-cond.s}
667     {{objdump -d jump-reloc-veneers-cond-long-backward.d}}
668     "jump-reloc-veneers-cond-long-backward"}
669
670    {"Default group size" "-Ttext 0x1000 --section-start .foo=0x2003020" "" "" {farcall-group.s farcall-group2.s}
671     {{objdump -d farcall-group.d}}
672     "farcall-group-default"}
673    {"Group size=2" "-Ttext 0x1000 --section-start .foo=0x2003020 --stub-group-size=2" "" "" {farcall-group.s farcall-group2.s}
674     {{objdump -d farcall-group-size2.d}}
675     "farcall-group-size2"}
676    {"Group size limit" "-Ttext 0x1000 --section-start .far=0x2003020" "" "" {farcall-group3.s farcall-group4.s}
677     {{objdump -d farcall-group-limit.d}}
678     "farcall-group-limit"}
679
680    {"TLS gnu shared library" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-gdesc.s}
681     {{objdump -fdw tls-gdesc.d} {objdump -Rw tls-gdesc.r}}
682     "tls-lib2.so"}
683    {"TLS gnu shared library non-lazy" "-z now -shared -T arm-dyn.ld" "" "" {tls-gdesc.s}
684     {{readelf "-x .got" tls-gdesc-nlazy.g}}
685     "tls-lib2-nlazy.so"}
686    {"TLS long plt library" "-shared -T arm-dyn.ld --section-start .foo=0x4001000" "" "" {tls-longplt-lib.s}
687     {{objdump -fdw tls-longplt-lib.d}}
688     "tls-longplt-lib.so"}
689    {"TLS long plt" "-T arm-dyn.ld --section-start .foo=0x4001000 tmpdir/tls-longplt-lib.so" "" "" {tls-longplt.s}
690     {{objdump -fdw tls-longplt.d}}
691     "tls-longplt"}
692    {"TLS thumb1" "-shared -T arm-dyn.ld --section-start .foo=0x4001000" "" "" {tls-thumb1.s}
693     {{objdump -fdw tls-thumb1.d}}
694     "tls-thumb1"}
695    {"Cortex-A8 erratum fix, b.w"
696     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-b.s}
697     {{objdump -dr cortex-a8-fix-b.d}}
698     "cortex-a8-fix-b"}
699    {"Cortex-A8 erratum fix, bl.w"
700     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-bl.s}
701     {{objdump -dr cortex-a8-fix-bl.d}}
702     "cortex-a8-fix-bl"}
703    {"Cortex-A8 erratum fix, bcc.w"
704     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-bcc.s}
705     {{objdump -dr cortex-a8-fix-bcc.d}}
706     "cortex-a8-fix-bcc"}
707    {"Cortex-A8 erratum fix, blx.w"
708     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-blx.s}
709     {{objdump -dr cortex-a8-fix-blx.d}}
710     "cortex-a8-fix-blx"}
711    {"Cortex-A8 erratum fix, relocate b.w to ARM"
712     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-b-rel.s}
713     {{objdump -dr cortex-a8-fix-b-rel-arm.d}}
714     "cortex-a8-fix-b-rel-arm"}
715    {"Cortex-A8 erratum fix, relocate b.w to Thumb"
716     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-b-rel.s}
717     {{objdump -dr cortex-a8-fix-b-rel-thumb.d}}
718     "cortex-a8-fix-b-rel-thumb"}
719    {"Cortex-A8 erratum fix, relocate bl.w to ARM"
720     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-bl-rel.s}
721     {{objdump -dr cortex-a8-fix-bl-rel-arm.d}}
722     "cortex-a8-fix-bl-rel-arm"}
723    {"Cortex-A8 erratum fix, relocate bl.w to Thumb"
724     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bl-rel.s}
725     {{objdump -dr cortex-a8-fix-bl-rel-thumb.d}}
726     "cortex-a8-fix-bl-rel-thumb"}
727    {"Cortex-A8 erratum fix, relocate b<cond>.w to Thumb"
728     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bcc-rel.s}
729     {{objdump -dr cortex-a8-fix-bcc-rel-thumb.d}}
730     "cortex-a8-fix-bcc-rel-thumb"}
731    {"Cortex-A8 erratum fix, relocate blx.w to ARM"
732     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-blx-rel.s}
733     {{objdump -dr cortex-a8-fix-blx-rel-arm.d}}
734     "cortex-a8-fix-blx-rel-arm"}
735    {"Cortex-A8 erratum fix, relocate blx.w to Thumb"
736     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-blx-rel.s}
737     {{objdump -dr cortex-a8-fix-blx-rel-thumb.d}}
738     "cortex-a8-fix-blx-rel-thumb"}
739    {"Cortex-A8 erratum fix, relocate bl.w and far call"
740     "-EL -Ttext=0x00 --fix-cortex-a8 --defsym _start=0" ""
741     "-EL -mcpu=cortex-a8" {cortex-a8-far-1.s cortex-a8-far-2.s cortex-a8-far-3.s}
742     {{objdump -dr cortex-a8-far.d}}
743     "cortex-a8-far"}
744    {"Cortex-A8 erratum fix, headers"
745     "-EL --fix-cortex-a8 -T cortex-a8-fix-hdr.t" ""
746     "-EL -mcpu=cortex-a8" {cortex-a8-fix-hdr.s}
747     {{objdump -dr cortex-a8-fix-hdr.d}}
748     "cortex-a8-fix-hdr"}
749    {"Cortex-A8 erratum fix, blx.w and b<cond>.w together"
750     "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-blx-bcond.s}
751     {{objdump -dr cortex-a8-fix-blx-bcond.d}}
752     "cortex-a8-fix-blx-bcond"}
753    {"Cortex-A8 erratum fix, b.w to PLT"
754     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "" "-EL"
755     {cortex-a8-fix-b-plt.s}
756     {{objdump -dr cortex-a8-fix-b-plt.d}}
757     "cortex-a8-fix-b-plt"}
758    {"Cortex-A8 erratum fix, bl.w to PLT"
759     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "" "-EL"
760     {cortex-a8-fix-bl-plt.s}
761     {{objdump -dr cortex-a8-fix-bl-plt.d}}
762     "cortex-a8-fix-bl-plt"}
763    {"Cortex-A8 erratum fix, bcc.w to PLT"
764     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "" "-EL"
765     {cortex-a8-fix-bcc-plt.s}
766     {{objdump -dr cortex-a8-fix-bcc-plt.d}}
767     "cortex-a8-fix-bcc-plt"}
768    {"Cortex-A8 erratum fix, blx.w to PLT"
769     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "" "-EL"
770     {cortex-a8-fix-blx-plt.s}
771     {{objdump -dr cortex-a8-fix-blx-plt.d}}
772     "cortex-a8-fix-blx-plt"}
773    {"Cortex-A8 erratum fix, relocate bl.w to PLT"
774     "-EL --section-start=.plt=0x8e00 -Ttext=0x8f00 --fix-cortex-a8 -shared" ""
775     "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bl-rel.s}
776     {{objdump -dr cortex-a8-fix-bl-rel-plt.d}}
777     "cortex-a8-fix-bl-rel-thumb"}
778    {"IFUNC test 1" "-T ifunc-static.ld" "" "" {ifunc-1.s}
779     {{objdump -d ifunc-1.dd}
780      {objdump {-s -j.data -j.got} ifunc-1.gd}
781      {readelf -dr ifunc-1.rd}}
782     "ifunc-1"}
783    {"IFUNC test 2" "-T ifunc-static.ld" "" "" {ifunc-2.s}
784     {{objdump -d ifunc-2.dd}
785      {objdump {-s -j.data -j.got} ifunc-2.gd}
786      {readelf -dr ifunc-2.rd}}
787     "ifunc-2"}
788    {"IFUNC test 3" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-3.s}
789     {{objdump -d ifunc-3.dd}
790      {objdump {-s -j.data -j.got} ifunc-3.gd}
791      {readelf -r ifunc-3.rd}}
792     "ifunc-3.so"}
793    {"IFUNC test 4" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-4.s}
794     {{objdump -d ifunc-4.dd}
795      {objdump {-s -j.data -j.got} ifunc-4.gd}
796      {readelf -r ifunc-4.rd}}
797     "ifunc-4.so"}
798    {"IFUNC test 5" "-T ifunc-static.ld" "" "" {ifunc-5.s}
799     {{objdump -d ifunc-5.dd}
800      {objdump {-s -j.data -j.got} ifunc-5.gd}
801      {readelf -dr ifunc-5.rd}}
802     "ifunc-5"}
803    {"IFUNC test 6" "-T ifunc-static.ld" "" "" {ifunc-6.s}
804     {{objdump -d ifunc-6.dd}
805      {objdump {-s -j.data -j.got} ifunc-6.gd}
806      {readelf -dr ifunc-6.rd}}
807     "ifunc-6"}
808    {"IFUNC test 7" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so -shared" ""
809     "" {ifunc-7.s}
810     {{objdump -d ifunc-7.dd}
811      {objdump {-s -j.data -j.got} ifunc-7.gd}
812      {readelf -r ifunc-7.rd}}
813     "ifunc-7.so"}
814    {"IFUNC test 8" "-T ifunc-dynamic.ld tmpdir/ifunc-4.so -shared" ""
815     "" {ifunc-8.s}
816     {{objdump -d ifunc-8.dd}
817      {objdump {-s -j.data -j.got} ifunc-8.gd}
818      {readelf -r ifunc-8.rd}}
819     "ifunc-8.so"}
820    {"IFUNC test 9" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so" "" "" {ifunc-9.s}
821     {{objdump -d ifunc-9.dd}
822      {objdump {-s -j.data -j.got} ifunc-9.gd}
823      {readelf -r ifunc-9.rd}}
824     "ifunc-9"}
825    {"IFUNC test 10" "-T ifunc-dynamic.ld tmpdir/ifunc-4.so" "" "" {ifunc-10.s}
826     {{objdump -d ifunc-10.dd}
827      {objdump {-s -j.data -j.got} ifunc-10.gd}
828      {readelf -r ifunc-10.rd}}
829     "ifunc-10"}
830    {"IFUNC test 11" "-T ifunc-static.ld" "" "" {ifunc-11.s}
831     {{objdump -d ifunc-11.dd}
832      {objdump {-s -j.data -j.got} ifunc-11.gd}
833      {readelf -dr ifunc-11.rd}}
834     "ifunc-11"}
835    {"IFUNC test 12" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-12.s}
836     {{objdump -d ifunc-12.dd}
837      {objdump {-s -j.data -j.got} ifunc-12.gd}
838      {readelf -r ifunc-12.rd}}
839     "ifunc-12.so"}
840    {"IFUNC test 13" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-13.s}
841     {{objdump -d ifunc-13.dd}
842      {objdump {-s -j.data -j.got} ifunc-13.gd}
843      {readelf -r ifunc-13.rd}}
844     "ifunc-13"}
845    {"IFUNC test 14" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-14.s}
846     {{objdump -d ifunc-14.dd}
847      {objdump {-s -j.data -j.got} ifunc-14.gd}
848      {readelf -r ifunc-14.rd}}
849     "ifunc-14"}
850    {"IFUNC test 15" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-15.s}
851     {{objdump -d ifunc-15.dd}
852      {objdump {-s -j.data -j.got} ifunc-15.gd}
853      {readelf -r ifunc-15.rd}}
854     "ifunc-15"}
855    {"IFUNC test 16" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-16.s}
856     {{objdump -d ifunc-16.dd}
857      {objdump {-s -j.data -j.got} ifunc-16.gd}
858      {readelf -r ifunc-16.rd}}
859     "ifunc-16"}
860    {"IFUNC test 17" "-T ifunc-static.ld" "" "" {ifunc-17.s}
861     {{objdump -d ifunc-17.dd}
862      {objdump {-s -j.data -j.got} ifunc-17.gd}
863      {readelf -r ifunc-17.rd}}
864     "ifunc-17"}
865    {"Long PLT entries in executables" "--long-plt -shared --section-start=.plt=0x1000 --section-start=.got=0xf0001100" ""
866     "" {long-plt-format.s}
867     {{objdump "-d -j .plt" long-plt-format.d}}
868     "long-plt-format"}
869    {"IFUNC and TLS descriptor shared library" "-shared -T arm-lib.ld --version-script=ifunc-gdesc.ver" "" "" {ifunc-gdesc.s}
870     {{objdump "-Rw" ifunc-gdesc.r}}
871     "ifunc-gdesc.so"}
872    {"arm-pic-veneer" "-static -T arm.ld --pic-veneer" "" "" {arm-pic-veneer.s}
873     {{objdump -d arm-pic-veneer.d}}
874     "arm-pic-veneer"}
875    {"Preempt Thumb symbol" "tmpdir/mixed-lib.so -T arm-dyn.ld --use-blx" "" ""
876     {preempt-app.s}
877     {{readelf -Ds preempt-app.sym}}
878     "preempt-app"}
879}
880
881# Massage the $armeabitests_common list into run_ld_link_tests standard form.
882# See the comment before 'set armeabitests_common', above.
883set elide_action_elt 3
884set is_nacl [istarget "arm*-*-nacl*"]
885if {$is_nacl} {
886    set elide_action_elt 2
887}
888set neabi_common [llength $armeabitests_common]
889for {set i 0} {$i < $neabi_common} {incr i} {
890    set case [lindex $armeabitests_common $i]
891    set actions [lindex $case 5]
892    set nactions [llength $actions]
893    for {set j 0} {$j < $nactions} {incr j} {
894	set action [lindex $actions $j]
895	if {[llength $action] == 4} {
896	    set action [lreplace $action $elide_action_elt $elide_action_elt]
897	    lset armeabitests_common $i 5 $j $action
898	}
899    }
900}
901
902run_ld_link_tests $armeabitests_common
903if { !$is_nacl } {
904    run_ld_link_tests $armeabitests_nonacl
905}
906
907run_dump_test "attr-merge-div-00"
908run_dump_test "attr-merge-div-01"
909run_dump_test "attr-merge-div-10"
910run_dump_test "attr-merge-div-01-m3"
911run_dump_test "attr-merge-div-10-m3"
912run_dump_test "attr-merge-div-11"
913run_dump_test "attr-merge-div-12"
914run_dump_test "attr-merge-div-120"
915run_dump_test "attr-merge-div-21"
916run_dump_test "attr-merge-div-22"
917run_dump_test "attr-merge-div-02"
918run_dump_test "attr-merge-div-20"
919run_dump_test "attr-merge-wchar-00"
920run_dump_test "attr-merge-wchar-02"
921run_dump_test "attr-merge-wchar-04"
922run_dump_test "attr-merge-wchar-20"
923run_dump_test "attr-merge-wchar-22"
924run_dump_test "attr-merge-wchar-24"
925run_dump_test "attr-merge-wchar-40"
926run_dump_test "attr-merge-wchar-42"
927run_dump_test "attr-merge-wchar-44"
928run_dump_test "attr-merge-wchar-00-nowarn"
929run_dump_test "attr-merge-wchar-02-nowarn"
930run_dump_test "attr-merge-wchar-04-nowarn"
931run_dump_test "attr-merge-wchar-20-nowarn"
932run_dump_test "attr-merge-wchar-22-nowarn"
933run_dump_test "attr-merge-wchar-24-nowarn"
934run_dump_test "attr-merge-wchar-40-nowarn"
935run_dump_test "attr-merge-wchar-42-nowarn"
936run_dump_test "attr-merge-wchar-44-nowarn"
937run_dump_test "farcall-section"
938run_dump_test "attr-merge-unknown-1"
939run_dump_test "attr-merge-unknown-2"
940run_dump_test "attr-merge-unknown-2r"
941run_dump_test "attr-merge-unknown-3"
942run_dump_test "unwind-1"
943run_dump_test "unwind-2"
944run_dump_test "unwind-3"
945run_dump_test "unwind-4"
946run_dump_test "unwind-5"
947run_dump_test "attr-merge-vfp-1"
948run_dump_test "attr-merge-vfp-1r"
949run_dump_test "attr-merge-vfp-2"
950run_dump_test "attr-merge-vfp-2r"
951run_dump_test "attr-merge-vfp-3"
952run_dump_test "attr-merge-vfp-3r"
953run_dump_test "attr-merge-vfp-4"
954run_dump_test "attr-merge-vfp-4r"
955run_dump_test "attr-merge-vfp-5"
956run_dump_test "attr-merge-vfp-5r"
957run_dump_test "attr-merge-vfp-6"
958run_dump_test "attr-merge-vfp-6r"
959run_dump_test "attr-merge-vfp-7"
960run_dump_test "attr-merge-vfp-7r"
961run_dump_test "attr-merge-vfp-8"
962run_dump_test "attr-merge-vfp-8r"
963run_dump_test "attr-merge-vfp-9"
964run_dump_test "attr-merge-vfp-9r"
965run_dump_test "attr-merge-vfp-10"
966run_dump_test "attr-merge-vfp-10r"
967run_dump_test "attr-merge-vfp-11"
968run_dump_test "attr-merge-vfp-11r"
969run_dump_test "attr-merge-vfp-12"
970run_dump_test "attr-merge-vfp-12r"
971run_dump_test "attr-merge-vfp-13"
972run_dump_test "attr-merge-vfp-13r"
973run_dump_test "attr-merge-vfp-14"
974run_dump_test "attr-merge-vfp-14r"
975run_dump_test "attr-merge-incompatible"
976run_dump_test "attr-merge-arch-2"
977run_dump_test "attr-merge-nosection-1"
978run_dump_test "attr-merge-hardfp-use-1"
979run_dump_test "attr-merge-hardfp-use-2"
980run_dump_test "unresolved-1"
981if { ![istarget "arm*-*-nacl*"] } {
982    run_dump_test "unresolved-1-dyn"
983}
984run_dump_test "unresolved-2"
985run_dump_test "gc-hidden-1"
986run_dump_test "protected-data"
987run_dump_test "stm32l4xx-cannot-fix-it-block"
988run_dump_test "stm32l4xx-cannot-fix-far-ldm"
989set arm_unwind_tests {
990    {"unwind-rel" "-r -Tarm.ld" "" "" {unwind-rel1.s unwind-rel2.s unwind-rel3.s}
991     {{readelf -ur unwind-rel.d}}
992     "unwind-rel"}
993    {"unwind-mix" "-Tarm.ld" "" "" {unwind-mix1.s unwind-mix2.s}
994     {{readelf -u unwind-mix.d}}
995     "unwind-mix"}
996}
997run_ld_link_tests $arm_unwind_tests
998