[ELF] Make section member orders consistent
[llvm-project.git] / lld / test / ELF / arm-thunk-linkerscript.s
blob131ab41a40a0c02aa38965e881d6bebe4d1d7180
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) } \
6 // RUN: .text_high 0x2000000 : { *(.text_high) *(.text_high2) } \
7 // RUN: } " > %t.script
8 // RUN: ld.lld --no-rosegment --script %t.script %t -o %t2
9 // RUN: llvm-objdump --no-print-imm-hex -d %t2 | FileCheck %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 | FileCheck %s
14 // RUN: ld.lld --be8 --no-rosegment --script %t.script %t -o %t2
15 // RUN: llvm-objdump --no-print-imm-hex -d %t2 | FileCheck %s
17 // Simple test that we can support range extension thunks with linker scripts
18 .syntax unified
19 .section .text_low, "ax", %progbits
20 .thumb
21 .globl _start
22 _start: bx lr
23 .globl low_target
24 .type low_target, %function
25 low_target:
26 bl high_target
27 bl high_target2
29 .section .text_low2, "ax", %progbits
30 .thumb
31 .globl low_target2
32 .type low_target2, %function
33 low_target2:
34 bl high_target
35 bl high_target2
37 // CHECK: Disassembly of section .text_low:
38 // CHECK-EMPTY:
39 // CHECK-NEXT: <_start>:
40 // CHECK-NEXT: 94: 4770 bx lr
41 // CHECK: <low_target>:
42 // CHECK-NEXT: 96: f000 f803 bl 0xa0 <__Thumbv7ABSLongThunk_high_target>
43 // CHECK-NEXT: 9a: f000 f806 bl 0xaa <__Thumbv7ABSLongThunk_high_target2>
44 // CHECK: <__Thumbv7ABSLongThunk_high_target>:
45 // CHECK-NEXT: a0: f240 0c01 movw r12, #1
46 // CHECK-NEXT: a4: f2c0 2c00 movt r12, #512
47 // CHECK-NEXT: a8: 4760 bx r12
48 // CHECK: <__Thumbv7ABSLongThunk_high_target2>:
49 // CHECK-NEXT: aa: f240 0c1d movw r12, #29
50 // CHECK-NEXT: ae: f2c0 2c00 movt r12, #512
51 // CHECK-NEXT: b2: 4760 bx r12
52 // CHECK: <low_target2>:
53 // CHECK-NEXT: b4: f7ff fff4 bl 0xa0 <__Thumbv7ABSLongThunk_high_target>
54 // CHECK-NEXT: b8: f7ff fff7 bl 0xaa <__Thumbv7ABSLongThunk_high_target2>
56 .section .text_high, "ax", %progbits
57 .thumb
58 .globl high_target
59 .type high_target, %function
60 high_target:
61 bl low_target
62 bl low_target2
64 .section .text_high2, "ax", %progbits
65 .thumb
66 .globl high_target2
67 .type high_target2, %function
68 high_target2:
69 bl low_target
70 bl low_target2
72 // CHECK: Disassembly of section .text_high:
73 // CHECK-EMPTY:
74 // CHECK-NEXT: <high_target>:
75 // CHECK-NEXT: 2000000: f000 f802 bl 0x2000008 <__Thumbv7ABSLongThunk_low_target>
76 // CHECK-NEXT: 2000004: f000 f805 bl 0x2000012 <__Thumbv7ABSLongThunk_low_target2>
77 // CHECK: <__Thumbv7ABSLongThunk_low_target>:
78 // CHECK-NEXT: 2000008: f240 0c97 movw r12, #151
79 // CHECK-NEXT: 200000c: f2c0 0c00 movt r12, #0
80 // CHECK-NEXT: 2000010: 4760 bx r12
81 // CHECK: <__Thumbv7ABSLongThunk_low_target2>:
82 // CHECK-NEXT: 2000012: f240 0cb5 movw r12, #181
83 // CHECK-NEXT: 2000016: f2c0 0c00 movt r12, #0
84 // CHECK-NEXT: 200001a: 4760 bx r12
85 // CHECK: <high_target2>:
86 // CHECK-NEXT: 200001c: f7ff fff4 bl 0x2000008 <__Thumbv7ABSLongThunk_low_target>
87 // CHECK-NEXT: 2000020: f7ff fff7 bl 0x2000012 <__Thumbv7ABSLongThunk_low_target2>