[JITLink][ELF][AArch64] Implement R_AARCH64_JUMP26

Implements 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

Reviewed By: sgraenitz

Differential Revision: https://reviews.llvm.org/D127059
This commit is contained in:
Sunho Kim 2022-06-10 10:57:16 +09:00
parent de7a6ae1ff
commit 175f22d6c3
2 changed files with 8 additions and 1 deletions

View File

@ -68,6 +68,7 @@ private:
using namespace aarch64; using namespace aarch64;
switch (Type) { switch (Type) {
case ELF::R_AARCH64_CALL26: case ELF::R_AARCH64_CALL26:
case ELF::R_AARCH64_JUMP26:
return ELFCall26; return ELFCall26;
case ELF::R_AARCH64_ADR_PREL_PG_HI21: case ELF::R_AARCH64_ADR_PREL_PG_HI21:
return ELFAdrPage21; return ELFAdrPage21;

View File

@ -15,9 +15,10 @@ main:
.size main, .-main .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_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 .globl local_func
.p2align 2 .p2align 2
.type local_func,@function .type local_func,@function
@ -31,6 +32,11 @@ local_func_call26:
bl local_func bl local_func
.size local_func_call26, .-local_func_call26 .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 # Check R_AARCH64_ADR_PREL_PG_HI21 / R_AARCH64_ADD_ABS_LO12_NC relocation of a local symbol
# #