1// REQUIRES: arm
2// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf --arm-add-build-attributes %s -o %t.o
3// RUN: ld.lld --fix-cortex-a8 --shared %t.o -o %t2
4// RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck %s
5
6/// Test case that for an OutputSection larger than the ThunkSectionSpacing
7/// --fix-cortex-a8 will cause the size of the ThunkSection to be rounded up to
8/// the nearest 4KiB
9 .thumb
10
11 .section .text.01, "ax", %progbits
12 .balign 4096
13 .globl _start
14 .type _start, %function
15_start:
16  /// state change thunk required
17  b.w arm_func
18thumb_target:
19  .space 4096 - 10
20  /// erratum patch needed
21  nop.w
22  b.w thumb_target
23
24/// Expect thunk and patch to be inserted here
25// CHECK:  00012004 <__ThumbV7PILongThunk_arm_func>:
26// CHECK-NEXT: 12004: movw    r12, #4088
27// CHECK-NEXT:        movt    r12, #256
28// CHECK-NEXT:        add     r12, pc
29// CHECK-NEXT:        bx      r12
30// CHECK:  00013004 <__CortexA8657417_11FFE>:
31// CHECK-NEXT: 13004: b.w     #-8196
32 .section .text.02
33 /// Take us over thunk section spacing
34 .space 16 * 1024 * 1024
35
36 .section .text.03, "ax", %progbits
37 .arm
38 .balign 4
39 .type arm_func, %function
40arm_func:
41  bx lr
42