[PATCH] D127059: [JITLink][ELF/AARCH64] Implement R_AARCH64_JUMP26

Sunho Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 4 17:37:15 PDT 2022


sunho created this revision.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
sunho requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch implemetns R_AARCH64_JUMP26. We can use the same generic aarch64 Branch26 edge since B instruction and BL nstruction have the same sized&offseted immediate field and the relocation address calculation is the same.

Reference: ELF for the ARM ® 64-bit Architecture Tabel 4-10, ARM Architecture Reference Manual ® ARMv8, for ARMv8-A architecture profile C6.2.24, C6.2.31


https://reviews.llvm.org/D127059

Files:
  llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
  llvm/test/ExecutionEngine/JITLink/AArch64/ELF_aarch64_relocations.s


Index: llvm/test/ExecutionEngine/JITLink/AArch64/ELF_aarch64_relocations.s
===================================================================
--- llvm/test/ExecutionEngine/JITLink/AArch64/ELF_aarch64_relocations.s
+++ llvm/test/ExecutionEngine/JITLink/AArch64/ELF_aarch64_relocations.s
@@ -14,9 +14,10 @@
 
         .size   main, .-main
 
-# Check R_AARCH64_CALL26 relocation of a local function call
+# Check R_AARCH64_CALL26 / R_AARCH64_JUMP26 relocation of a local function call
 #
 # jitlink-check: decode_operand(local_func_call26, 0)[25:0] = (local_func - local_func_call26)[27:2]
+# jitlink-check: decode_operand(local_func_jump26, 0)[25:0] = (local_func - local_func_jump26)[27:2]
         .globl  local_func
         .p2align  2
         .type	local_func, at function
@@ -30,6 +31,11 @@
         bl	local_func
         .size   local_func_call26, .-local_func_call26
 
+        .globl  local_func_jump26
+        .p2align  2
+local_func_jump26:
+        b	local_func
+        .size   local_func_jump26, .-local_func_jump26
 
 # Check R_AARCH64_ADR_PREL_PG_HI21 / R_AARCH64_ADD_ABS_LO12_NC relocation of a local symbol
 #
Index: llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
+++ llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
@@ -53,6 +53,7 @@
     using namespace aarch64;
     switch (Type) {
     case ELF::R_AARCH64_CALL26:
+    case ELF::R_AARCH64_JUMP26:
       return ELFCall26;
     case ELF::R_AARCH64_ADR_PREL_PG_HI21:
       return ELFAdrPage21;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127059.434298.patch
Type: text/x-patch
Size: 1588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220605/30fc986f/attachment.bin>


More information about the llvm-commits mailing list