OSDN Git Service

[ORC] Add an early out for MachOPlatform's init-scraper plugin setup.
authorLang Hames <lhames@gmail.com>
Wed, 2 Sep 2020 03:00:21 +0000 (20:00 -0700)
committerLang Hames <lhames@gmail.com>
Wed, 2 Sep 2020 03:12:23 +0000 (20:12 -0700)
If there's no initializer symbol in the current MaterializationResponsibility
then bail out without installing JITLink passes: they're going to be no-ops
anyway.

llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp

index 9ad2577..098e870 100644 (file)
@@ -299,6 +299,9 @@ void MachOPlatform::InitScraperPlugin::modifyPassConfig(
     MaterializationResponsibility &MR, const Triple &TT,
     jitlink::PassConfiguration &Config) {
 
+  if (!MR.getInitializerSymbol())
+    return;
+
   Config.PrePrunePasses.push_back([this, &MR](jitlink::LinkGraph &G) -> Error {
     JITLinkSymbolVector InitSectionSymbols;
     preserveInitSectionIfPresent(InitSectionSymbols, G, "__mod_init_func");