• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 -verbose %t.o -o /dev/null 2>&1 | FileCheck %s
4/// Test that we warn, but don't attempt to patch when it is impossible to
5/// redirect the branch as the Section is too large.
6
7// CHECK: skipping cortex-a8 657417 erratum sequence, section .text is too large to patch
8// CHECK: skipping cortex-a8 657417 erratum sequence, section .text.02 is too large to patch
9
10 .syntax unified
11 .thumb
12/// Case 1: 1 MiB conditional branch range without relocation.
13 .text
14 .global _start
15 .type _start, %function
16 .balign 4096
17 .thumb_func
18_start:
19 nop.w
20 .space 4086
21 .thumb_func
22 .global target
23 .type target, %function
24target:
25/// 32-bit Branch spans 2 4KiB regions, preceded by a 32-bit non branch
26/// instruction, a patch will be attempted. Unfortunately the branch
27/// cannot reach outside the section so we have to abort the patch.
28 nop.w
29 beq.w target
30 .space 1024 * 1024
31
32/// Case 2: 16 MiB
33 .section .text.01, "ax", %progbits
34 .balign 4096
35  .space 4090
36 .global target2
37 .thumb_func
38target2:
39 .section .text.02, "ax", %progbits
40/// 32-bit Branch and link spans 2 4KiB regions, preceded by a 32-bit
41/// non branch instruction, a patch will be be attempted. Unfortunately the
42/// the BL cannot reach outside the section so we have to abort the patch.
43 nop.w
44 bl target2
45 .space 16 * 1024 * 1024
46