[PATCH] D155925: [JITLink][PowerPC][WIP] Change method to check if a symbol is external to current object

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 20:11:03 PDT 2023


lkail updated this revision to Diff 543800.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155925

Files:
  llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
  llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp


Index: llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
+++ llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
@@ -218,8 +218,9 @@
       break;
     case ELF::R_PPC64_REL24_NOTOC:
     case ELF::R_PPC64_REL24: {
-      bool isLocal = !GraphSymbol->isExternal();
-      if (isLocal) {
+      bool isExternal =
+          (*ObjSymbol)->isUndefined() && (*ObjSymbol)->isExternal();
+      if (!isExternal) {
         // TODO: There are cases a local function call need a call stub.
         // 1. Caller uses TOC, the callee doesn't, need a r2 save stub.
         // 2. Caller doesn't use TOC, the callee does, need a r12 setup stub.
Index: llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
+++ llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
@@ -175,13 +175,13 @@
 
   bool visitEdge(LinkGraph &G, Block *B, Edge &E) {
     Edge::Kind K = E.getKind();
-    if (K == ppc64::RequestPLTCallStubSaveTOC && E.getTarget().isExternal()) {
+    if (K == ppc64::RequestPLTCallStubSaveTOC) {
       E.setKind(ppc64::CallBranchDeltaRestoreTOC);
       this->StubKind = LongBranchSaveR2;
       E.setTarget(this->getEntryForTarget(G, E.getTarget()));
       return true;
     }
-    if (K == ppc64::RequestPLTCallStubNoTOC && E.getTarget().isExternal()) {
+    if (K == ppc64::RequestPLTCallStubNoTOC) {
       E.setKind(ppc64::CallBranchDelta);
       this->StubKind = LongBranchNoTOC;
       E.setTarget(this->getEntryForTarget(G, E.getTarget()));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155925.543800.patch
Type: text/x-patch
Size: 1674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230725/ae266af6/attachment.bin>


More information about the llvm-commits mailing list