File: arm-thumb-undefined-weak.s

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (48 lines) | stat: -rw-r--r-- 1,470 bytes parent folder | download | duplicates (2)
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
// REQUIRES: arm
// RUN: llvm-mc --arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
// RUN: ld.lld %t -o %t2
// RUN: llvm-objdump --triple=thumbv7a-none-linux-gnueabi -d %t2 | FileCheck %s

/// 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
 .type target, %function

 .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 - .
/// R_ARM_THM_ALU_PREL_11_0
/// adr r0, target
 .inst.w 0xf2af0004
 .reloc 0x18, R_ARM_THM_ALU_PREL_11_0, target
/// R_ARM_THM_PC12
/// ldr r0, target
 .inst.w 0xf85f0004
 .reloc 0x1c, R_ARM_THM_PC12, target
// CHECK: Disassembly of section .text:
// CHECK-EMPTY:
// CHECK:         200b4: {{.*}} beq.w   #0 <_start+0x4>
// CHECK-NEXT:    200b8: {{.*}} b.w     #0 <_start+0x8>
// CHECK-NEXT:    200bc: {{.*}} bl      #0
/// blx is transformed into bl so we don't change state
// CHECK-NEXT:    200c0: {{.*}} bl      #0
// CHECK-NEXT:    200c4: {{.*}} movt    r0, #0
// CHECK-NEXT:    200c8: {{.*}} movw    r0, #0
// CHECK-NEXT:    200cc: {{.*}} adr.w   r0, #-4
// CHECK-NEXT:    200d0: {{.*}} ldr.w   r0, [pc, #-4]