[PATCH] D106554: [ORC] Work around AIX build compiler: Replace lambda; NFC

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 08:12:32 PDT 2021


hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: lhames, jsji, qiucf, rzurob, daltenty.
Herald added a subscriber: hiraditya.
hubert.reinterpretcast requested review of this revision.
Herald added a project: LLVM.

By replacing a lambda expression with a functor class instance, this
patch works around an issue encountered on AIX where the IBM XL compiler
appears to make no progress for many hours.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106554

Files:
  llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp


Index: llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
+++ llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
@@ -446,19 +446,28 @@
     return;
   }
 
-  // FIXME: Proper mangling.
+  // Use functor class to work around XL build compiler issue on AIX.
+  class RtLookupNotifyComplete {
+  public:
+    RtLookupNotifyComplete(SendSymbolAddressFn &&SendResult)
+        : SendResult(std::move(SendResult)) {}
+    void operator()(Expected<SymbolMap> Result) {
+      if (Result) {
+        assert(Result->size() == 1 && "Unexpected result map count");
+        SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
+      } else {
+        SendResult(Result.takeError());
+      }
+    }
+
+  private:
+    SendSymbolAddressFn SendResult;
+  };
   auto MangledName = ("_" + SymbolName).str();
   ES.lookup(
       LookupKind::DLSym, {{JD, JITDylibLookupFlags::MatchExportedSymbolsOnly}},
       SymbolLookupSet(ES.intern(MangledName)), SymbolState::Ready,
-      [SendResult = std::move(SendResult)](Expected<SymbolMap> Result) mutable {
-        if (Result) {
-          assert(Result->size() == 1 && "Unexpected result map count");
-          SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
-        } else
-          SendResult(Result.takeError());
-      },
-      NoDependenciesToRegister);
+      RtLookupNotifyComplete(std::move(SendResult)), NoDependenciesToRegister);
 }
 
 Error MachOPlatform::bootstrapMachORuntime(JITDylib &PlatformJD) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106554.360821.patch
Type: text/x-patch
Size: 1595 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210722/58ca39bb/attachment.bin>


More information about the llvm-commits mailing list