OSDN Git Service

[ORC] Fix MachOPlatform's synthetic symbol dependence registration.
authorLang Hames <lhames@gmail.com>
Wed, 2 Sep 2020 02:55:19 +0000 (19:55 -0700)
committerLang Hames <lhames@gmail.com>
Wed, 2 Sep 2020 03:12:23 +0000 (20:12 -0700)
A think-o in the existing code meant that dependencies were never registered.
This failure could lead to crashes rather than orderly error propagation if
initialization dependencies failed to materialize.

No test case: The bug was discovered in an out-of-tree code and requires
pathalogically misconfigured JIT to generate the original error that lead to
the crash.

llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp

index 2d6435f..9ad2577 100644 (file)
@@ -305,7 +305,7 @@ void MachOPlatform::InitScraperPlugin::modifyPassConfig(
     preserveInitSectionIfPresent(InitSectionSymbols, G, "__objc_selrefs");
     preserveInitSectionIfPresent(InitSectionSymbols, G, "__objc_classlist");
 
-    if (!InitSymbolDeps.empty()) {
+    if (!InitSectionSymbols.empty()) {
       std::lock_guard<std::mutex> Lock(InitScraperMutex);
       InitSymbolDeps[&MR] = std::move(InitSectionSymbols);
     }