[llvm] d6791fb - [JITLink][PowerPC] Fix relocations in stubs for ppc64 big-endian target
Kai Luo via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 8 19:04:05 PDT 2023
Author: Kai Luo
Date: 2023-08-09T02:04:01Z
New Revision: d6791fb77402e8d3719ee991a20187cec15dcfde
URL: https://github.com/llvm/llvm-project/commit/d6791fb77402e8d3719ee991a20187cec15dcfde
DIFF: https://github.com/llvm/llvm-project/commit/d6791fb77402e8d3719ee991a20187cec15dcfde.diff
LOG: [JITLink][PowerPC] Fix relocations in stubs for ppc64 big-endian target
Offset and addend are fixed for big-endian stubs.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D157257
Added:
Modified:
llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_relocations.s
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h b/llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
index 4d08fd04c5a523..411e2bf3ab7d30 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
@@ -80,25 +80,29 @@ inline PLTCallStubInfo pickStub(PLTCallStubKind StubKind) {
isLE ? PointerJumpStubContent_little : PointerJumpStubContent_big;
// Skip save r2.
Content = Content.slice(4);
+ size_t Offset = isLE ? 0 : 2;
return PLTCallStubInfo{
Content,
- {{TOCDelta16HA, 0, 0}, {TOCDelta16LO, 4, 0}},
+ {{TOCDelta16HA, Offset, 0}, {TOCDelta16LO, Offset + 4, 0}},
};
}
case LongBranchSaveR2: {
ArrayRef<char> Content =
isLE ? PointerJumpStubContent_little : PointerJumpStubContent_big;
+ size_t Offset = isLE ? 4 : 6;
return PLTCallStubInfo{
Content,
- {{TOCDelta16HA, 4, 0}, {TOCDelta16LO, 8, 0}},
+ {{TOCDelta16HA, Offset, 0}, {TOCDelta16LO, Offset + 4, 0}},
};
}
case LongBranchNoTOC: {
ArrayRef<char> Content = isLE ? PointerJumpStubNoTOCContent_little
: PointerJumpStubNoTOCContent_big;
+ size_t Offset = isLE ? 16 : 18;
+ Edge::AddendT Addend = isLE ? 8 : 10;
return PLTCallStubInfo{
Content,
- {{Delta16HA, 16, 8}, {Delta16LO, 20, 12}},
+ {{Delta16HA, Offset, Addend}, {Delta16LO, Offset + 4, Addend + 4}},
};
}
}
diff --git a/llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_relocations.s b/llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_relocations.s
index 74d7379c44ba8e..dcbd172c881e59 100644
--- a/llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_relocations.s
+++ b/llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_relocations.s
@@ -8,7 +8,7 @@
# RUN: --check %s %t/elf_reloc.o
# RUN: llvm-mc --triple=powerpc64-unknown-linux-gnu --filetype=obj -o \
# RUN: %t/elf_reloc.o %s
-# RUN: not llvm-jitlink --noexec \
+# RUN: llvm-jitlink --noexec \
# RUN: --abs external_data=0xdeadbeef \
# RUN: --abs external_func=0xcafef00d \
# RUN: --abs external_func_notoc=0x88880000 \
More information about the llvm-commits
mailing list