1// REQUIRES: aarch64
2// RUN: llvm-mc -filetype=obj -triple=aarch64-windows %s -o %t.obj
3// RUN: lld-link -entry:main -subsystem:console %t.obj -out:%t.exe -verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
4// RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=DISASM %s
5
6// VERBOSE: Added 2 thunks with margin {{.*}} in 1 passes
7
8    .globl main
9    .globl func1
10    .globl func2
11    .text
12main:
13    tbz w0, #0, func1
14    ret
15    .section .text$a, "xr"
16    .space 0x8000
17    .section .text$b, "xr"
18func1:
19    tbz w0, #0, func2
20    ret
21    .space 1
22    .section .text$c, "xr"
23    .space 0x8000
24    .section .text$d, "xr"
25    .align 2
26func2:
27    ret
28
29// DISASM: 0000000140001000 <.text>:
30// DISASM: 140001000:      40 00 00 36     tbz     w0, #0, 0x140001008 <.text+0x8>
31// DISASM: 140001004:      c0 03 5f d6     ret
32// DISASM: 140001008:      50 00 00 90     adrp    x16, #32768
33// DISASM: 14000100c:      10 52 00 91     add     x16, x16, #20
34// DISASM: 140001010:      00 02 1f d6     br      x16
35
36// DISASM: 140009014:      60 00 00 36     tbz     w0, #0, 0x140009020 <.text+0x8020>
37// DISASM: 140009018:      c0 03 5f d6     ret
38
39// DISASM: 140009020:      50 00 00 90     adrp    x16, #32768
40// DISASM: 140009024:      10 b2 00 91     add     x16, x16, #44
41// DISASM: 140009028:      00 02 1f d6     br      x16
42
43// DISASM: 14001102c:      c0 03 5f d6     ret
44