Skip to content

Commit af5602d

Browse files
[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
1 parent f060aa1 commit af5602d

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -446,19 +446,30 @@ void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
446446
return;
447447
}
448448

449+
// Use functor class to work around XL build compiler issue on AIX.
450+
class RtLookupNotifyComplete {
451+
public:
452+
RtLookupNotifyComplete(SendSymbolAddressFn &&SendResult)
453+
: SendResult(std::move(SendResult)) {}
454+
void operator()(Expected<SymbolMap> Result) {
455+
if (Result) {
456+
assert(Result->size() == 1 && "Unexpected result map count");
457+
SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
458+
} else {
459+
SendResult(Result.takeError());
460+
}
461+
}
462+
463+
private:
464+
SendSymbolAddressFn SendResult;
465+
};
466+
449467
// FIXME: Proper mangling.
450468
auto MangledName = ("_" + SymbolName).str();
451469
ES.lookup(
452470
LookupKind::DLSym, {{JD, JITDylibLookupFlags::MatchExportedSymbolsOnly}},
453471
SymbolLookupSet(ES.intern(MangledName)), SymbolState::Ready,
454-
[SendResult = std::move(SendResult)](Expected<SymbolMap> Result) mutable {
455-
if (Result) {
456-
assert(Result->size() == 1 && "Unexpected result map count");
457-
SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
458-
} else
459-
SendResult(Result.takeError());
460-
},
461-
NoDependenciesToRegister);
472+
RtLookupNotifyComplete(std::move(SendResult)), NoDependenciesToRegister);
462473
}
463474

464475
Error MachOPlatform::bootstrapMachORuntime(JITDylib &PlatformJD) {

0 commit comments

Comments
 (0)