[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / arm-thunk-linkerscript-dotexpr.s
blob21849aa3e9e298bda826ab1c1f7837fa95933830
1 // REQUIRES: arm
2 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
3 // RUN: echo "SECTIONS { \
4 // RUN: . = SIZEOF_HEADERS; \
5 // RUN: .text_low : { *(.text_low) *(.text_low2) . = . + 0x2000000 ; *(.text_high) *(.text_high2) } \
6 // RUN: } " > %t.script
7 // RUN: ld.lld --no-rosegment --script %t.script %t -o %t2
8 // RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x94 --stop-address=0xbc | FileCheck --check-prefix=CHECK1 %s
9 // RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x20000bc --stop-address=0x20000de | FileCheck --check-prefix=CHECK2 %s
11 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7aeb-none-linux-gnueabi -mcpu=cortex-a8 %s -o %t
12 // RUN: ld.lld --no-rosegment --script %t.script %t -o %t2
13 // RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x94 --stop-address=0xbc | FileCheck --check-prefix=CHECK1 %s
14 // RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x20000bc --stop-address=0x20000de | FileCheck --check-prefix=CHECK2 %s
15 // RUN: ld.lld --be8 --no-rosegment --script %t.script %t -o %t2
16 // RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x94 --stop-address=0xbc | FileCheck --check-prefix=CHECK1 %s
17 // RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x20000bc --stop-address=0x20000de | FileCheck --check-prefix=CHECK2 %s
19 // Test that range extension thunks can handle location expressions within
20 // a Section Description
21 .syntax unified
22 .section .text_low, "ax", %progbits
23 .thumb
24 .globl _start
25 _start: bx lr
26 .globl low_target
27 .type low_target, %function
28 low_target:
29 bl high_target
30 bl high_target2
32 .section .text_low2, "ax", %progbits
33 .thumb
34 .globl low_target2
35 .type low_target2, %function
36 low_target2:
37 bl high_target
38 bl high_target2
39 // CHECK1: Disassembly of section .text_low:
40 // CHECK1-EMPTY:
41 // CHECK1-NEXT: <_start>:
42 // CHECK1-NEXT: 94: 4770 bx lr
43 // CHECK1: <low_target>:
44 // CHECK1-NEXT: 96: f000 f803 bl 0xa0 <__Thumbv7ABSLongThunk_high_target>
45 // CHECK1-NEXT: 9a: f000 f806 bl 0xaa <__Thumbv7ABSLongThunk_high_target2>
46 // CHECK1: <__Thumbv7ABSLongThunk_high_target>:
47 // CHECK1-NEXT: a0: f240 0cbd movw r12, #189
48 // CHECK1-NEXT: a4: f2c0 2c00 movt r12, #512
49 // CHECK1-NEXT: a8: 4760 bx r12
50 // CHECK1: <__Thumbv7ABSLongThunk_high_target2>:
51 // CHECK1-NEXT: aa: f240 0cd9 movw r12, #217
52 // CHECK1-NEXT: ae: f2c0 2c00 movt r12, #512
53 // CHECK1-NEXT: b2: 4760 bx r12
54 // CHECK1: <low_target2>:
55 // CHECK1-NEXT: b4: f7ff fff4 bl 0xa0 <__Thumbv7ABSLongThunk_high_target>
56 // CHECK1-NEXT: b8: f7ff fff7 bl 0xaa <__Thumbv7ABSLongThunk_high_target2>
58 .section .text_high, "ax", %progbits
59 .thumb
60 .globl high_target
61 .type high_target, %function
62 high_target:
63 bl low_target
64 bl low_target2
66 .section .text_high2, "ax", %progbits
67 .thumb
68 .globl high_target2
69 .type high_target2, %function
70 high_target2:
71 bl low_target
72 bl low_target2
74 // CHECK2: <high_target>:
75 // CHECK2-NEXT: 20000bc: f000 f802 bl 0x20000c4 <__Thumbv7ABSLongThunk_low_target>
76 // CHECK2-NEXT: 20000c0: f000 f805 bl 0x20000ce <__Thumbv7ABSLongThunk_low_target2>
77 // CHECK2: <__Thumbv7ABSLongThunk_low_target>:
78 // CHECK2-NEXT: 20000c4: f240 0c97 movw r12, #151
79 // CHECK2-NEXT: 20000c8: f2c0 0c00 movt r12, #0
80 // CHECK2-NEXT: 20000cc: 4760 bx r12
81 // CHECK2: <__Thumbv7ABSLongThunk_low_target2>:
82 // CHECK2-NEXT: 20000ce: f240 0cb5 movw r12, #181
83 // CHECK2-NEXT: 20000d2: f2c0 0c00 movt r12, #0
84 // CHECK2-NEXT: 20000d6: 4760 bx r12
85 // CHECK2: <high_target2>:
86 // CHECK2-NEXT: 20000d8: f7ff fff4 bl 0x20000c4 <__Thumbv7ABSLongThunk_low_target>
87 // CHECK2-NEXT: 20000dc: f7ff fff7 bl 0x20000ce <__Thumbv7ABSLongThunk_low_target2>