1// REQUIRES: arm
2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
3// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %S/Inputs/far-arm-thumb-abs.s -o %tfar
4// RUN: ld.lld  %t %tfar -o %t2
5// RUN: llvm-objdump -d --triple=thumbv7a-none-linux-gnueabi %t2
6 .syntax unified
7 .thumb
8 .section .text, "ax",%progbits
9 .globl _start
10 .balign 0x10000
11 .type _start,%function
12_start:
13 // address of too_far symbols are just out of range of ARM branch with
14 // 26-bit immediate field and an addend of -8
15 bl  too_far1
16 b   too_far2
17 beq.w too_far3
18
19// CHECK: Disassembly of section .text:
20// CHECK-EMPTY:
21// CHECK-NEXT: _start:
22// CHECK-NEXT:    20000:       00 f0 04 f8     bl      #8
23// CHECK-NEXT:    20004:       00 f0 07 b8     b.w     #14 <__Thumbv7ABSLongThunk_too_far2>
24// CHECK-NEXT:    20008:       00 f0 0a 80     beq.w   #20 <__Thumbv7ABSLongThunk_too_far3>
25// CHECK: __Thumbv7ABSLongThunk_too_far1:
26// CHECK-NEXT:    2000c:       40 f2 05 0c     movw    r12, #5
27// CHECK-NEXT:    20010:       c0 f2 02 1c     movt    r12, #258
28// CHECK-NEXT:    20014:       60 47   bx      r12
29// CHECK: __Thumbv7ABSLongThunk_too_far2:
30// CHECK-NEXT:    20016:       40 f2 09 0c     movw    r12, #9
31// CHECK-NEXT:    2001a:       c0 f2 02 1c     movt    r12, #258
32// CHECK-NEXT:    2001e:       60 47   bx      r12
33// CHECK: __Thumbv7ABSLongThunk_too_far3:
34// CHECK-NEXT:    20020:       40 f2 0d 0c     movw    r12, #13
35// CHECK-NEXT:    20024:       c0 f2 12 0c     movt    r12, #18
36// CHECK-NEXT:    20028:       60 47   bx      r12
37// CHECK-NEXT:    2002a:       00 00   movs    r0, r0
38