[llvm] [JITLink][AArch32] Add GOT builder and implement R_ARM_GOT_PREL relocations for ELF (PR #78753)

Stefan Gränitz via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 10:16:27 PST 2024


================
@@ -28,10 +29,43 @@ rel32:
 	.word target - .
 	.size rel32, .-rel32
 
-# Empty main function for jitlink to be happy
+# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_GOT_PREL target
+#
+# The GOT entry contains the absolute address of the external:
+# jitlink-check: *{4}(got_addr(out.o, target)) = target
+#
+# The embedded offset value contains the offset to the GOT entry relative to pc.
+# The +12 accounts for the ARM branch offset (8) and the .LPC offset (4), which
+# is stored as initial addend inline.
+# FIXME: We shouldn't need to substract the 64-bit sign-extension manually.
+# jitlink-check: *{4}got_prel_offset = got_addr(out.o, target) - (got_prel + 12) - 0xffffffff00000000
----------------
weliveindetail wrote:

The offset is a signed 32-bit value and it doesn't get sign-extended to JITLink's 64-bit target address type. We should probably fix that, but it seems outside the scope of this PR.

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


More information about the llvm-commits mailing list