File: arm-bl-v6.s

package info (click to toggle)
llvm-toolchain-6.0 1%3A6.0.1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 598,080 kB
  • sloc: cpp: 3,046,253; ansic: 595,057; asm: 271,965; python: 128,926; objc: 106,554; sh: 21,906; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,227; cs: 2,027; xml: 686; php: 212; csh: 117
file content (51 lines) | stat: -rw-r--r-- 1,631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// RUN: llvm-mc -filetype=obj -triple=arm-none-linux-gnueabi %s -o %t
// RUN: ld.lld %t -o %t2 2>&1 | FileCheck %s
// REQUIRES: arm

// On Arm v6 the range of a Thumb BL instruction is only 4 megabytes as the
// extended range encoding is not supported. The following example has a Thumb
// BL that is out of range on ARM v6 and requires a range extension thunk.
// As v6 does not support MOVT or MOVW instructions the Thunk must not
// use these instructions either. At present we don't support v6 so we give a
// warning for unsupported features.

// CHECK: warning: lld uses extended branch encoding, no object with architecture supporting feature detected.
// CHECK-NEXT: warning: lld may use movt/movw, no object with architecture supporting feature detected.
// ARM v6 supports blx so we shouldn't see the blx not supported warning.
// CHECK-NOT: warning: lld uses blx instruction, no object with architecture supporting feature detected.
 .text
 .syntax unified
 .cpu    arm1176jzf-s
 .eabi_attribute 6, 6    @ Tag_CPU_arch
 .globl _start
 .type   _start,%function
 .balign 0x1000
_start:
  bl thumbfunc
  bx lr

 .thumb
 .section .text.2, "ax", %progbits
 .globl thumbfunc
 .type thumbfunc,%function
thumbfunc:
 bl farthumbfunc

// 6 Megabytes, enough to make farthumbfunc out of range of caller on a v6
// Arm, but not on a v7 Arm.
 .section .text.3, "ax", %progbits
 .space 0x200000

 .section .text.4, "ax", %progbits
 .space 0x200000

 .section .text.5, "ax", %progbits
 .space 0x200000

 .thumb
 .section .text.6, "ax", %progbits
 .balign 0x1000
 .globl farthumbfunc
 .type farthumbfunc,%function
farthumbfunc:
 bx lr