[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:21:56 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:

Are these offsets the way they are (all -8) because they come from unresolved locations? So later, that -8 becomes the proper offset?

If not you'd expect references to foo1, foo2 and foo3 to have different immediates here.

But I think it's the first thing, and I have just forgotten how relocations work :)

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


More information about the llvm-commits mailing list