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: echo "SECTIONS { \
5// RUN:          . = 0xb4; \
6// RUN:          .callee1 : { *(.callee_low) } \
7// RUN:          .caller : { *(.text) } \
8// RUN:          .callee2 : { *(.callee_high) } } " > %t.script
9// RUN: ld.lld --script %t.script %t %tfar -o %t2
10// RUN: llvm-objdump -d --triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck  %s
11
12 .syntax unified
13 .thumb
14 .section .callee_low, "ax",%progbits
15 .align 2
16 .type callee_low,%function
17callee_low:
18 bx lr
19
20 .section .text, "ax",%progbits
21 .globl _start
22 .balign 0x10000
23 .type _start,%function
24_start:
25 bl  callee_low
26 b   callee_low
27 beq callee_low
28 bl  callee_high
29 b   callee_high
30 bne callee_high
31 bl  far_uncond
32 b   far_uncond
33 bgt far_cond
34 bx lr
35
36 .section .callee_high, "ax",%progbits
37 .align 2
38 .type callee_high,%function
39callee_high:
40 bx lr
41
42// CHECK: Disassembly of section .callee1:
43// CHECK-EMPTY:
44// CHECK-NEXT: <callee_low>:
45// CHECK-NEXT:      b4:       70 47   bx      lr
46// CHECK-EMPTY:
47// CHECK-NEXT: Disassembly of section .caller:
48// CHECK-EMPTY:
49// CHECK-NEXT: <_start>:
50// CHECK-NEXT:   10000:       f0 f7 58 f8     bl      #-65360
51// CHECK-NEXT:   10004:       f0 f7 56 b8     b.w     #-65364
52// CHECK-NEXT:   10008:       30 f4 54 a8     beq.w   #-65368
53// CHECK-NEXT:   1000c:       00 f0 0c f8     bl      #24
54// CHECK-NEXT:   10010:       00 f0 0a b8     b.w     #20
55// CHECK-NEXT:   10014:       40 f0 08 80     bne.w   #16
56// CHECK-NEXT:   10018:       ff f3 ff d7     bl      #16777214
57// CHECK-NEXT:   1001c:       ff f3 fd 97     b.w     #16777210
58// CHECK-NEXT:   10020:       3f f3 ff af     bgt.w   #1048574
59// CHECK-NEXT:   10024:       70 47   bx      lr
60// CHECK-NEXT:   10026:
61// CHECK-EMPTY:
62// CHECK-NEXT: Disassembly of section .callee2:
63// CHECK-EMPTY:
64// CHECK-NEXT: <callee_high>:
65// CHECK-NEXT:   10028:       70 47   bx      lr
66