[PATCH] D157519: [JITLink][AArch32] Tests for ELF::R_ARM_ABS32 and ELF::R_ARM_REL32

Stefan Gränitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 08:54:01 PST 2023


sgraenitz updated this revision to Diff 558027.
sgraenitz added a comment.

Data relocations have no alignment requirements. Check it by turning target into a data symbol itself and injecting an uneven address.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157519/new/

https://reviews.llvm.org/D157519

Files:
  llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_data_reloc.s


Index: llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_data_reloc.s
===================================================================
--- /dev/null
+++ llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_data_reloc.s
@@ -0,0 +1,37 @@
+# RUN: llvm-mc -triple=armv7-none-linux-gnueabi -arm-add-build-attributes -filetype=obj -o %t.o %s
+# RUN: llvm-objdump -r %t.o | FileCheck --check-prefix=CHECK-TYPE %s
+# RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb -slab-page-size 4096 \
+# RUN:               -abs target=0x76bbe88f -show-entry-es -check %s %t.o
+
+# RUN: llvm-mc -triple=thumbv7-none-linux-gnueabi -arm-add-build-attributes -filetype=obj -o %t.o %s
+# RUN: llvm-objdump -r %t.o | FileCheck --check-prefix=CHECK-TYPE %s
+# RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb -slab-page-size 4096 \
+# RUN:               -abs target=0x76bbe88f -show-entry-es -check %s %t.o
+
+	.data
+	.global target
+
+	.text
+	.syntax unified
+
+# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_ABS32 target
+# jitlink-check: *{4}(abs32) = target
+	.global abs32
+abs32:
+	.word target
+	.size   abs32, .-abs32
+
+# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_REL32 target
+# jitlink-check: (rel32 + *{4}(rel32))[31:0] = target
+	.global rel32
+ rel32:
+	.word target - .
+	.size rel32, .-rel32
+
+	.globl  main
+	.type main, %function
+	.p2align  2
+
+main:
+	bx lr
+	.size   main, .-main


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157519.558027.patch
Type: text/x-patch
Size: 1405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20231106/501a14d0/attachment.bin>


More information about the llvm-commits mailing list