[PATCH] D157257: [JITLink][PowerPC] Fix relocations in stubs for ppc64 big-endian target

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 19:04:08 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd6791fb77402: [JITLink][PowerPC] Fix relocations in stubs for ppc64 big-endian target (authored by lkail).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157257

Files:
  llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
  llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_relocations.s


Index: llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_relocations.s
===================================================================
--- llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_relocations.s
+++ 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 \
Index: llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
+++ llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
@@ -80,25 +80,29 @@
         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}},
     };
   }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157257.548440.patch
Type: text/x-patch
Size: 2074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230809/f93e1082/attachment.bin>


More information about the llvm-commits mailing list