[llvm] [llvm][MC][ARM][Assembly] Emit relocs for LDRs (PR #72873)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 09:24:43 PST 2023


================
@@ -0,0 +1,41 @@
+@ RUN: llvm-mc -filetype=obj -triple=armv7 %s -o %t
+@ RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=ARM
+@ RUN: llvm-objdump -d --triple=armv7 %t | FileCheck %s --check-prefix=ARM_ADDEND
+
+@ ARM: R_ARM_LDRS_PC_G0
+@ ARM: foo1
+@ ARM: R_ARM_LDRS_PC_G0
+@ ARM: foo2
+@ ARM: R_ARM_LDRS_PC_G0
+@ ARM: foo3
+
+// The value format is decimal in these specific cases, but it's hex for other
+// ldr instructions. These checks are valid for both formats.
+
+@ ARM_ADDEND: r0, [pc, #-
----------------
DavidSpickett wrote:

Istr something about the value of the PC while executing an instruction at address N is actually N+something (8?) so these would be loading from themselves. But only because they're waiting for a linker to fill in the real value.

https://github.com/llvm/llvm-project/pull/72873


More information about the llvm-commits mailing list