[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / arm-bl-v6.s
blob9b78a2d93756367488e4a40105c2907071bcd117
1 // REQUIRES: arm
2 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv6-none-linux-gnueabi %s -o %t
3 // RUN: ld.lld %t -o %t2
4 // RUN: llvm-objdump --no-print-imm-hex -d --triple=armv6-none-linux-gnueabi --start-address=0x21000 --stop-address=0x21008 %t2 | FileCheck --check-prefix=CHECK-ARM1 %s
5 // RUN: llvm-objdump --no-print-imm-hex -d --triple=thumbv6-none-linux-gnueabi %t2 --start-address=0x21008 --stop-address=0x2100c | FileCheck --check-prefix=CHECK-THUMB1 %s
6 // RUN: llvm-objdump --no-print-imm-hex -d --triple=armv6-none-linux-gnueabi --start-address=0x22100c --stop-address=0x221014 %t2 | FileCheck --check-prefix=CHECK-ARM2 %s
7 // RUN: llvm-objdump --no-print-imm-hex -d --triple=thumbv6-none-linux-gnueabi %t2 --start-address=0x622000 --stop-address=0x622002 | FileCheck --check-prefix=CHECK-THUMB2 %s
9 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv6eb-none-linux-gnueabi %s -o %t
10 // RUN: ld.lld %t -o %t2
11 // RUN: llvm-objdump --no-print-imm-hex -d --triple=armv6eb-none-linux-gnueabi --start-address=0x21000 --stop-address=0x21008 %t2 | FileCheck --check-prefix=CHECK-ARM1 %s
12 // RUN: llvm-objdump --no-print-imm-hex -d --triple=thumbv6eb-none-linux-gnueabi %t2 --start-address=0x21008 --stop-address=0x2100c | FileCheck --check-prefix=CHECK-THUMB1 %s
13 // RUN: llvm-objdump --no-print-imm-hex -d --triple=armv6eb-none-linux-gnueabi --start-address=0x22100c --stop-address=0x221014 %t2 | FileCheck --check-prefix=CHECK-ARM2-EB %s
14 // RUN: llvm-objdump --no-print-imm-hex -d --triple=thumbv6eb-none-linux-gnueabi %t2 --start-address=0x622000 --stop-address=0x622002 | FileCheck --check-prefix=CHECK-THUMB2 %s
16 // RUN: ld.lld --be8 %t -o %t2
17 // RUN: llvm-objdump --no-print-imm-hex -d --triple=armv6eb-none-linux-gnueabi --start-address=0x21000 --stop-address=0x21008 %t2 | FileCheck --check-prefix=CHECK-ARM1 %s
18 // RUN: llvm-objdump --no-print-imm-hex -d --triple=thumbv6eb-none-linux-gnueabi %t2 --start-address=0x21008 --stop-address=0x2100c | FileCheck --check-prefix=CHECK-THUMB1 %s
19 // RUN: llvm-objdump --no-print-imm-hex -d --triple=armv6eb-none-linux-gnueabi --start-address=0x22100c --stop-address=0x221014 %t2 | FileCheck --check-prefix=CHECK-ARM2-EB %s
20 // RUN: llvm-objdump --no-print-imm-hex -d --triple=thumbv6eb-none-linux-gnueabi %t2 --start-address=0x622000 --stop-address=0x622002 | FileCheck --check-prefix=CHECK-THUMB2 %s
22 /// On Arm v6 the range of a Thumb BL instruction is only 4 megabytes as the
23 /// extended range encoding is not supported. The following example has a Thumb
24 /// BL that is out of range on ARM v6 and requires a range extension thunk.
25 /// As v6 does not support MOVT or MOVW instructions the Thunk must not
26 /// use these instructions either.
29 /// ARM v6 supports blx so we shouldn't see the blx not supported warning.
30 // CHECK-NOT: warning: lld uses blx instruction, no object with architecture supporting feature detected.
31 .text
32 .syntax unified
33 .cpu arm1176jzf-s
34 .globl _start
35 .type _start,%function
36 .balign 0x1000
37 _start:
38 bl thumbfunc
39 bx lr
41 // CHECK-ARM1: Disassembly of section .text:
42 // CHECK-ARM1-EMPTY:
43 // CHECK-ARM1-NEXT: <_start>:
44 // CHECK-ARM1-NEXT: 21000: fa000000 blx 0x21008 <thumbfunc>
45 // CHECK-ARM1-NEXT: 21004: e12fff1e bx lr
46 .thumb
47 .section .text.2, "ax", %progbits
48 .globl thumbfunc
49 .type thumbfunc,%function
50 thumbfunc:
51 bl farthumbfunc
53 // CHECK-THUMB1: <thumbfunc>:
54 // CHECK-THUMB1-NEXT: 21008: f200 e800 blx 0x22100c <__ARMv5LongLdrPcThunk_farthumbfunc>
55 /// 6 Megabytes, enough to make farthumbfunc out of range of caller
56 /// on a v6 Arm, but not on a v7 Arm.
58 .section .text.3, "ax", %progbits
59 .space 0x200000
60 // CHECK-ARM2: <__ARMv5LongLdrPcThunk_farthumbfunc>:
61 // CHECK-ARM2-NEXT: 22100c: e51ff004 ldr pc, [pc, #-4]
62 // CHECK-ARM2-NEXT: 221010: 01 20 62 00 .word 0x00622001
63 // CHECK-ARM2-EB: <__ARMv5LongLdrPcThunk_farthumbfunc>:
64 // CHECK-ARM2-EB-NEXT: 22100c: e51ff004 ldr pc, [pc, #-4]
65 // CHECK-ARM2-EB-NEXT: 221010: 00 62 20 01 .word 0x00622001
66 .section .text.4, "ax", %progbits
67 .space 0x200000
69 .section .text.5, "ax", %progbits
70 .space 0x200000
72 .thumb
73 .section .text.6, "ax", %progbits
74 .balign 0x1000
75 .globl farthumbfunc
76 .type farthumbfunc,%function
77 farthumbfunc:
78 bx lr
79 // CHECK-THUMB2: <farthumbfunc>:
80 // CHECK-THUMB2-NEXT: 622000: 4770 bx lr