xref: /llvm-project/llvm/test/MC/ARM/pcrel-ldr-relocs.s (revision c0944f52c17a30762b81446183967ce3ef6b9aed)
1bbc5d9feSEleanor Bonnici@ RUN: llvm-mc -filetype=obj -triple=armv7 %s -o %t
2bbc5d9feSEleanor Bonnici@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=ARM
3bbc5d9feSEleanor Bonnici@ RUN: llvm-objdump -d --triple=armv7 %t | FileCheck %s --check-prefix=ARM_ADDEND
4bbc5d9feSEleanor Bonnici@ RUN: llvm-mc -filetype=obj -triple=thumbv7 %s -o %t
5bbc5d9feSEleanor Bonnici@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=THUMB
6bbc5d9feSEleanor Bonnici@ RUN: llvm-objdump -d --triple=thumbv7 %t | FileCheck %s --check-prefix=THUMB_ADDEND
76e3b2cb4SEleanor Bonnici@ RUN: llvm-mc -filetype=obj -triple=armebv7 %s -o %t
86e3b2cb4SEleanor Bonnici@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=ARM
96e3b2cb4SEleanor Bonnici@ RUN: llvm-objdump -d --triple=armebv7 %t | FileCheck %s --check-prefix=ARM_ADDEND
106e3b2cb4SEleanor Bonnici@ RUN: llvm-mc -filetype=obj -triple=thumbebv7 %s -o %t
116e3b2cb4SEleanor Bonnici@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=THUMB
126e3b2cb4SEleanor Bonnici@ RUN: llvm-objdump -d --triple=thumbebv7 %t | FileCheck %s --check-prefix=THUMB_ADDEND
13bbc5d9feSEleanor Bonnici
14bbc5d9feSEleanor Bonnici@ ARM: R_ARM_LDR_PC_G0
15bbc5d9feSEleanor Bonnici@ ARM: R_ARM_LDR_PC_G0
16bbc5d9feSEleanor Bonnici@ ARM: R_ARM_LDR_PC_G0
17bbc5d9feSEleanor Bonnici@ ARM: R_ARM_LDR_PC_G0
18bbc5d9feSEleanor Bonnici@ ARM_ADDEND: r0, [pc, #-0x8]
19bbc5d9feSEleanor Bonnici@ ARM_ADDEND: r0, [pc, #-0x8]
20bbc5d9feSEleanor Bonnici@ ARM_ADDEND: r0, [pc, #-0x10]
21bbc5d9feSEleanor Bonnici@ ARM_ADDEND: r0, [pc]
22bbc5d9feSEleanor Bonnici
23bbc5d9feSEleanor Bonnici@ THUMB: R_ARM_THM_PC12
24bbc5d9feSEleanor Bonnici@ THUMB: R_ARM_THM_PC12
25bbc5d9feSEleanor Bonnici@ THUMB: R_ARM_THM_PC12
26bbc5d9feSEleanor Bonnici@ THUMB: R_ARM_THM_PC12
27bbc5d9feSEleanor Bonnici@ THUMB_ADDEND: r0, [pc, #-0x4]
28bbc5d9feSEleanor Bonnici@ THUMB_ADDEND: r0, [pc, #-0x4]
29bbc5d9feSEleanor Bonnici@ THUMB_ADDEND: r0, [pc, #-0xc]
30bbc5d9feSEleanor Bonnici@ THUMB_ADDEND: r0, [pc, #0x4]
31bbc5d9feSEleanor Bonnici
32bbc5d9feSEleanor Bonnici    .section .text.bar, "ax"
33bbc5d9feSEleanor Bonnici    .balign 4
34bbc5d9feSEleanor Bonnici    .global bar
35bbc5d9feSEleanor Bonnici    .type bar, %function
36bbc5d9feSEleanor Bonnicibar:
37*c0944f52SEleanor Bonnici    ldr r0, foo1      @ arm_ldst_pcrel_12 / t2_ldst_pcrel_12
38*c0944f52SEleanor Bonnici    ldrb r0, foo1     @ arm_ldst_pcrel_12 / t2_ldst_pcrel_12
39*c0944f52SEleanor Bonnici    ldr r0, foo2-8    @ arm_ldst_pcrel_12 / t2_ldst_pcrel_12
40*c0944f52SEleanor Bonnici    ldrb r0, foo1+8   @ arm_ldst_pcrel_12 / t2_ldst_pcrel_12
41bbc5d9feSEleanor Bonnici    bx lr
42bbc5d9feSEleanor Bonnici
43bbc5d9feSEleanor Bonnici    .section .data.foo, "a", %progbits
44bbc5d9feSEleanor Bonnici    .balign 4
45bbc5d9feSEleanor Bonnici    .global foo1
46bbc5d9feSEleanor Bonnici    .global foo2
47bbc5d9feSEleanor Bonnicifoo1:
48bbc5d9feSEleanor Bonnici    .word 0x11223344, 0x55667788
49bbc5d9feSEleanor Bonnicifoo2:
50bbc5d9feSEleanor Bonnici    .word 0x99aabbcc, 0xddeeff00
51