2 // RUN
: llvm-mc
--triple
=armv7a-none-eabi
--arm-add-build-attributes
-filetype
=obj
-o
%t.o
%s
3 // RUN
: ld.lld
%t.o
-o
%t
4 // RUN
: llvm-objdump
-d
--no-show-raw-insn
--triple
=armv7a-none-eabi
%t | FileCheck
%s
6 /// Test the short range cases of R_ARM_ALU_PC_G0. The range of the instruction
7 /// depends on the number of trailing zeros of the displacement. In practice
8 /// the maximum effective range will
be 1024 bytes
, which is
a 4-byte aligned
9 /// instruction to
a 4-byte aligned word.
12 .section .os1, "ax", %progbits
23 .section .os2, "ax", %progbits
26 .type _start, %function
30 .reloc 0, R_ARM_ALU_PC_G0, dat1
33 .reloc 4, R_ARM_ALU_PC_G0, dat2
36 .reloc 8, R_ARM_ALU_PC_G0, dat3
39 .reloc 0xc, R_ARM_ALU_PC_G0, dat4
41 .section .os3, "ax", %progbits
52 .section .os4, "ax", %progbits
54 .type tfunc, %function
58 .section .os5, "ax", %progbits
60 .type arm_func, %function
66 .reloc 0, R_ARM_ALU_PC_G0, tfunc
69 .reloc 4, R_ARM_ALU_PC_G0, afunc
72 .section .os6, "ax", %progbits
73 .type afunc, %function
78 // CHECK
: 00020410 <dat1
>:
79 // CHECK-NEXT
: 20410: andeq
r0, r0, r0
81 // CHECK
: 00020414 <dat2
>:
82 // CHECK-NEXT
: 20414: andeq
r0, r0, r0
84 // CHECK
: 00020800 <_start
>:
85 /// 0x20800 + 0x8 - 0x3f8 = 0x11410 = dat1
86 // CHECK-NEXT
: 20800: sub r0, pc
, #1016
87 /// 0x20804 + 0x8 - 0x3f8 = 0x11414 = dat2
88 // CHECK-NEXT
: 20804: sub r0, pc
, #1016
89 /// 0x20808 + 0x8 + 0x400 = 0x11c10 = dat3
90 // CHECK-NEXT
: 20808: add r0, pc
, #64, #28
91 /// 0x2080c + 0x8 + 0x400 = 0x11c14 = dat4
92 // CHECK-NEXT
: 2080c
: add r0, pc
, #64, #28
94 // CHECK
: 00020c10
<dat3
>:
95 // CHECK-NEXT
: 20c10
: andeq
r0, r0, r0
97 // CHECK
: 00020c14
<dat4
>:
98 // CHECK-NEXT
: 20c14
: andeq
r0, r0, r0
100 // CHECK
: 00020c18
<tfunc
>:
101 // CHECK-NEXT
: 20c18
: bx
lr
103 // CHECK
: 00020c1c
<arm_func
>:
104 /// 0x20c1c + 0x8 - 0xb = 11c19
= tfunc
105 // CHECK-NEXT
: 20c1c
: sub r0, pc
, #11
106 /// 0x20c20 + 0x8 = 0x11c28 = afunc
107 // CHECK-NEXT
: 20c20
: add r0, pc
, #0
108 // CHECK-NEXT
: 20c24
: bx
lr
110 // CHECK
: 00020c28
<afunc
>:
111 // CHECK-NEXT
: 20c28
: bx
lr