[llvm] af5602d - [ORC] Work around AIX build compiler: Replace lambda; NFC

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 07:12:33 PDT 2021


Author: Hubert Tong
Date: 2021-07-23T10:12:26-04:00
New Revision: af5602d369a5cfb4d77c6dd2fe1d0834de87ac76

URL: https://github.com/llvm/llvm-project/commit/af5602d369a5cfb4d77c6dd2fe1d0834de87ac76
DIFF: https://github.com/llvm/llvm-project/commit/af5602d369a5cfb4d77c6dd2fe1d0834de87ac76.diff

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

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.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D106554

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
index 2a6583249cad..c96049afec19 100644
--- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
@@ -446,19 +446,30 @@ void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
     return;
   }
 
+  // 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;
+  };
+
   // FIXME: Proper mangling.
   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) {


        


More information about the llvm-commits mailing list