1// REQUIRES: arm
2// RUN: llvm-mc --arm-add-build-attributes -filetype=obj -triple=thumbv5-none-linux-gnueabi %s -o %t
3// RUN: ld.lld %t -o %t2
4// RUN: llvm-objdump --no-show-raw-insn --triple=thumbv6a-none-linux-gnueabi -d %t2 | FileCheck %s
5
6/// Check that the ARM ABI rules for undefined weak symbols are applied.
7/// Relative relocations are resolved to the place. Although we can't encode
8/// this for R_ARM_THM_PC8 as negative addends are not permitted. Use smallest
9/// available value. These are corner cases.
10 .syntax unified
11
12 .weak target
13 .type target, %function
14
15 .text
16 .global _start
17_start:
18 /// R_ARM_THM_PC8
19 /// adr r0, target
20 .inst.n 0xa0ff
21 .reloc 0, R_ARM_THM_PC8, target
22 /// ldr r0, target
23 .inst.n 0x48ff
24 .reloc 2, R_ARM_THM_PC8, target
25// CHECK:      000200b4 <_start>:
26// CHECK-NEXT: 200b4: adr     r0, #0
27// CHECK-NEXT:        ldr     r0, [pc, #0]
28