1// REQUIRES: arm
2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
3// RUN: ld.lld --image-base=0x10000000 %t -o %t2
4// RUN: llvm-objdump --triple=armv7a-none-linux-gnueabi --no-show-raw-insn -d %t2 | FileCheck %s
5
6/// Check that the ARM ABI rules for undefined weak symbols are applied.
7/// Branch instructions are resolved to the next instruction. Undefined
8/// Symbols in relative are resolved to the place so S - P + A = A.
9/// We place the image-base at 0x10000000 to test that a range extensions thunk
10/// is not generated.
11
12 .syntax unified
13
14 .weak target
15 .type target, %function
16
17 .text
18 .global _start
19_start:
20/// R_ARM_JUMP24
21 b target
22/// R_ARM_CALL
23 bl target
24/// R_ARM_CALL with exchange
25 blx target
26/// R_ARM_MOVT_PREL
27 movt r0, :upper16:target - .
28/// R_ARM_MOVW_PREL_NC
29 movw r0, :lower16:target - .
30/// R_ARM_REL32
31 .word target - .
32
33// CHECK: Disassembly of section .text:
34// CHECK-EMPTY:
35// CHECK-NEXT: 100100b4 <_start>:
36// CHECK-NEXT: 100100b4: b       #-4
37// CHECK-NEXT: 100100b8: bl      #-4
38// CHECK-NEXT: 100100bc: bl      #-4
39// CHECK-NEXT: 100100c0: movt    r0, #0
40// CHECK-NEXT: 100100c4: movw    r0, #0
41// CHECK:      100100c8: 00 00 00 00     .word   0x00000000
42