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

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 01:41:20 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, #-
+@ ARM_ADDEND 8]
+@ ARM_ADDEND: r0, [pc, #-
+@ ARM_ADDEND 8]
+@ ARM_ADDEND: r0, [pc, #-
+@ ARM_ADDEND 8]
----------------
DavidSpickett wrote:

As per usual there's a few ways and they are all indirectly documented. This is the closest I found for regex https://llvm.org/docs/TestingGuide.html

And not for this, but in general you'll see these https://llvm.org/docs/CommandGuide/lit.html#substitutions around.

I wouldn't commit them to memory though, just be aware they are out there and only a few "find in files" away if you need to know what they are.

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


More information about the llvm-commits mailing list