[ELF] Make section member orders consistent
[llvm-project.git] / lld / test / ELF / aarch64-thunk-script.s
bloba6c524f5482882101243161f2d5c86f85e30e9a5
1 // REQUIRES: aarch64
2 // RUN: split-file %s %t
3 // RUN: llvm-mc -filetype=obj -triple=aarch64 %t/asm -o %t.o
4 // RUN: ld.lld --script %t/lds %t.o -o %t/out
5 // RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t/out | FileCheck %s
6 // RUN: llvm-nm --no-sort --special-syms %t/out | FileCheck --check-prefix=NM %s
8 //--- asm
9 // Check that we have the out of branch range calculation right. The immediate
10 // field is signed so we have a slightly higher negative displacement.
11 .section .text_low, "ax", %progbits
12 .globl _start
13 .type _start, %function
14 _start:
15 // Need thunk to high_target@plt
16 bl high_target
17 // Need thunk to .text_high+4
18 bl .text_high+4
19 ret
21 .section .text_high, "ax", %progbits
22 .globl high_target
23 .type high_target, %function
24 high_target:
25 // No Thunk needed as we are within signed immediate range
26 bl _start
27 ret
29 // CHECK: Disassembly of section .text_low:
30 // CHECK-EMPTY:
31 // CHECK-NEXT: <_start>:
32 // CHECK-NEXT: 2000: bl 0x200c <__AArch64AbsLongThunk_high_target>
33 // CHECK-NEXT: 2004: bl 0x2010 <__AArch64AbsLongThunk_>
34 // CHECK-NEXT: ret
35 // CHECK: <__AArch64AbsLongThunk_high_target>:
36 // CHECK-NEXT: 200c: b 0x8002000 <high_target>
37 // CHECK: <__AArch64AbsLongThunk_>:
38 // CHECK-NEXT: 2010: b 0x8002004 <high_target+0x4>
39 // CHECK: Disassembly of section .text_high:
40 // CHECK-EMPTY:
41 // CHECK-NEXT: <high_target>:
42 // CHECK-NEXT: 8002000: bl 0x2000 <_start>
43 // CHECK-NEXT: ret
45 /// Local symbols copied from %t.o
46 // NM: t $x
47 // NM-NEXT: t $x
48 /// Local thunk symbols.
49 // NM-NEXT: t __AArch64AbsLongThunk_high_target
50 // NM-NEXT: t $x
51 // NM-NEXT: t __AArch64AbsLongThunk_{{$}}
52 // NM-NEXT: t $x
53 /// Global symbols.
54 // NM-NEXT: T _start
55 // NM-NEXT: T high_target
57 //--- lds
58 PHDRS {
59 low PT_LOAD FLAGS(0x1 | 0x4);
60 high PT_LOAD FLAGS(0x1 | 0x4);
62 SECTIONS {
63 .text_low 0x2000: { *(.text_low) } :low
64 .text_high 0x8002000 : { *(.text_high) } :high