File: arm-thumb-undefined-weak.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 (38 lines) | stat: -rw-r--r-- 1,106 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
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
// RUN: ld.lld %t -o %t2 2>&1
// RUN: llvm-objdump -triple=thumbv7a-none-linux-gnueabi -d %t2 | FileCheck %s
// REQUIRES: arm

// Check that the ARM ABI rules for undefined weak symbols are applied.
// Branch instructions are resolved to the next instruction. Relative
// relocations are resolved to the place.

 .syntax unified

 .weak target

 .text
 .global _start
_start:
// R_ARM_THM_JUMP19
 beq.w target
// R_ARM_THM_JUMP24
 b.w target
// R_ARM_THM_CALL
 bl target
// R_ARM_THM_CALL with exchange
 blx target
// R_ARM_THM_MOVT_PREL
 movt r0, :upper16:target - .
// R_ARM_THM_MOVW_PREL_NC
 movw r0, :lower16:target - .

// CHECK: Disassembly of section .text:
// 69636 = 0x11004
// CHECK:         11000: {{.*}} beq.w   #0 <_start+0x4>
// CHECK-NEXT:    11004: {{.*}} b.w     #0 <_start+0x8>
// CHECK-NEXT:    11008: {{.*}} bl      #0
// blx is transformed into bl so we don't change state
// CHECK-NEXT:    1100c: {{.*}} bl      #0
// CHECK-NEXT:    11010: {{.*}} movt    r0, #0
// CHECK-NEXT:    11014: {{.*}} movw    r0, #0