[PATCH] D126658: [JITLink][ELF/AARCH64] Implement R_AARCH64_ABS64 relocation type
Sunho Kim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 10:05:22 PDT 2022
sunho updated this revision to Diff 433785.
sunho added a comment.
Rebase
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126658/new/
https://reviews.llvm.org/D126658
Files:
llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h
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
@@ -1,6 +1,7 @@
# RUN: rm -rf %t && mkdir -p %t
# RUN: llvm-mc -triple=aarch64-unknown-linux-gnu -relax-relocations=false -position-independent -filetype=obj -o %t/elf_reloc.o %s
-# RUN: llvm-jitlink -noexec -check %s %t/elf_reloc.o
+# RUN: llvm-jitlink -noexec \
+# RUN: -check %s %t/elf_reloc.o
.text
@@ -113,6 +114,15 @@
str x0, [x1, :lo12:named_data]
.size test_str_64bit, .-test_str_64bit
+# Check R_AARCH64_ABS64 relocation of a function pointer to local symbol
+#
+# jitlink-check: *{8}local_func_addr_quad = named_func
+ .globl local_func_addr_quad
+ .p2align 3
+local_func_addr_quad:
+ .xword named_func
+ .size local_func_addr_quad, 8
+
.globl named_data
.p2align 4
.type named_data, at object
@@ -120,3 +130,10 @@
.quad 0x2222222222222222
.quad 0x3333333333333333
.size named_data, .-named_data
+
+ .globl named_func
+ .p2align 2
+ .type named_func, at function
+named_func:
+ ret
+ .size named_func, .-named_func
Index: llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
+++ llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
@@ -65,6 +65,8 @@
return ELFLdSt64Abs12;
case ELF::R_AARCH64_LDST128_ABS_LO12_NC:
return ELFLdSt128Abs12;
+ case ELF::R_AARCH64_ABS64:
+ return ELFAbs64;
}
return make_error<JITLinkError>("Unsupported aarch64 relocation:" +
@@ -189,6 +191,10 @@
Kind = aarch64::PageOffset12;
break;
}
+ case ELFAbs64: {
+ Kind = aarch64::Pointer64;
+ break;
+ }
};
Edge GE(Kind, Offset, *GraphSymbol, Addend);
@@ -264,6 +270,8 @@
return "ELFLdSt64Abs12";
case ELF_aarch64_Edges::ELFLdSt128Abs12:
return "ELFLdSt128Abs12";
+ case ELF_aarch64_Edges::ELFAbs64:
+ return "ELFAbs64";
default:
return getGenericEdgeKindName(static_cast<Edge::Kind>(R));
}
Index: llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h
+++ llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h
@@ -30,6 +30,7 @@
ELFLdSt32Abs12,
ELFLdSt64Abs12,
ELFLdSt128Abs12,
+ ELFAbs64
};
} // namespace ELF_aarch64_Edges
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126658.433785.patch
Type: text/x-patch
Size: 2742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220602/277aca41/attachment.bin>
More information about the llvm-commits
mailing list