1// REQUIRES: arm
2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
3// RUN: ld.lld %t -o %t2
4// RUN: llvm-objdump -d --no-show-raw-insn --triple=thumbv7a-none-linux-gnueabi --start-address=0x21000 --stop-address=0x21006 %t2 | FileCheck --check-prefix=CHECK1 %s
5// RUN: llvm-objdump -d --no-show-raw-insn --triple=thumbv7a-none-linux-gnueabi --start-address=0x22004 --stop-address=0x22008 %t2 | FileCheck --check-prefix=CHECK2 %s
6// RUN: llvm-objdump -d --no-show-raw-insn --triple=thumbv7a-none-linux-gnueabi --start-address=0x1021ff8 --stop-address=0x1021ffc %t2 | FileCheck --check-prefix=CHECK3 %s
7// RUN: llvm-objdump -d --no-show-raw-insn --triple=thumbv7a-none-linux-gnueabi --start-address=0x2012ff8 --stop-address=0x2021ffc %t2 | FileCheck --check-prefix=CHECK4 %s
8// RUN: llvm-objdump -d --no-show-raw-insn --triple=thumbv7a-none-linux-gnueabi --start-address=0x3021fec --stop-address=0x3021ff6 %t2 | FileCheck --check-prefix=CHECK5 %s
9 .syntax unified
10 .balign 0x1000
11 .thumb
12 .text
13 .globl _start
14 .type _start, %function
15_start:
16 bx lr
17 .space 0x1000
18// CHECK1:      <_start>:
19// CHECK1-NEXT:   21000: bx      lr
20// CHECK1:      <$d.1>:
21// CHECK1-NEXT:   21002:       00 00 00 00 .word 0x00000000
22
23
24// CHECK2:      <__Thumbv7ABSLongThunk__start>:
25// CHECK2-NEXT:    22004: b.w     #-4104 <_start>
26
27/// Gigantic section where we need a ThunkSection either side of it
28 .section .text.large1, "ax", %progbits
29 .balign 4
30 .space (16 * 1024 * 1024) - 16
31 bl _start
32 .space (16 * 1024 * 1024) - 4
33 bl _start
34 .space (16 * 1024 * 1024) - 16
35// CHECK3: 1021ff8: bl      #-16777208
36// CHECK4: 2021ff8: bl      #16777200
37
38// CHECK5:      <__Thumbv7ABSLongThunk__start>:
39// CHECK5-NEXT:  3021fec: movw    r12, #4097
40// CHECK5-NEXT:  3021ff0: movt    r12, #2
41// CHECK5-NEXT:  3021ff4: bx      r12
42