From 7899ccbcca9dd69ad21231a047c1e6130528937e Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sat, 13 Oct 2018 21:53:40 +0000 Subject: [PATCH] [ORC] During lookup, do not match against hidden symbols in other JITDylibs. This adds two arguments to the main ExecutionSession::lookup method: MatchNonExportedInJD, and MatchNonExported. These control whether and where hidden symbols should be matched when searching a list of JITDylibs. A similar effect could have been achieved by filtering search results, but this would have involved materializing symbol definitions (since materialization is triggered on lookup) only to throw the results away, among other issues. llvm-svn: 344467 --- llvm/include/llvm/ExecutionEngine/Orc/Core.h | 56 +++++++------ llvm/lib/ExecutionEngine/Orc/Core.cpp | 94 +++++++++++++--------- llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp | 5 +- llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp | 3 +- llvm/lib/ExecutionEngine/Orc/LLJIT.cpp | 2 +- llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp | 4 +- .../Orc/RTDyldObjectLinkingLayer.cpp | 2 +- .../unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp | 60 ++++++++------ 8 files changed, 129 insertions(+), 97 deletions(-) diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h index f3ea2ae..24cdeea 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -628,10 +628,12 @@ private: const SymbolNameSet &Names); void lodgeQuery(std::shared_ptr &Q, - SymbolNameSet &Unresolved, MaterializationUnitList &MUs); + SymbolNameSet &Unresolved, JITDylib *MatchNonExportedInJD, + bool MatchNonExported, MaterializationUnitList &MUs); void lodgeQueryImpl(std::shared_ptr &Q, - SymbolNameSet &Unresolved, MaterializationUnitList &MUs); + SymbolNameSet &Unresolved, JITDylib *MatchNonExportedInJD, + bool MatchNonExported, MaterializationUnitList &MUs); LookupImplActionFlags lookupImpl(std::shared_ptr &Q, @@ -766,9 +768,19 @@ public: /// dependenant symbols for this query (e.g. it is being made by a top level /// client to get an address to call) then the value NoDependenciesToRegister /// can be used. + /// + /// If the MatchNonExportedInJD pointer is non-null, then the lookup will find + /// non-exported symbols defined in the JITDylib pointed to by + /// MatchNonExportedInJD. + /// If MatchNonExported is true the lookup will find non-exported symbols in + /// any JITDylib (setting MatchNonExportedInJD is redundant in such cases). + /// If MatchNonExported is false and MatchNonExportedInJD is null, + /// non-exported symbols will never be found. void lookup(const JITDylibList &JDs, SymbolNameSet Symbols, SymbolsResolvedCallback OnResolve, SymbolsReadyCallback OnReady, - RegisterDependenciesFunction RegisterDependencies); + RegisterDependenciesFunction RegisterDependencies, + JITDylib *MatchNonExportedInJD = nullptr, + bool MatchNonExported = false); /// Blocking version of lookup above. Returns the resolved symbol map. /// If WaitUntilReady is true (the default), will not return until all @@ -779,18 +791,22 @@ public: /// error will be reported via reportErrors. Expected lookup(const JITDylibList &JDs, const SymbolNameSet &Symbols, - RegisterDependenciesFunction RegisterDependencies, - bool WaitUntilReady = true); - - /// Convenience version of the blocking version of lookup above. Uses the main - /// JITDylib's search order as the lookup order, and registers no - /// dependencies. - Expected lookup(const SymbolNameSet &Symbols) { - return getMainJITDylib().withSearchOrderDo( - [&](const JITDylibList &SearchOrder) { - return lookup(SearchOrder, Symbols, NoDependenciesToRegister, true); - }); - } + RegisterDependenciesFunction RegisterDependencies = + NoDependenciesToRegister, + bool WaitUntilReady = true, + JITDylib *MatchNonExportedInJD = nullptr, + bool MatchNonExported = false); + + /// Convenience version of blocking lookup. + /// Performs a single-symbol lookup. + Expected lookup(const JITDylibList &JDs, + SymbolStringPtr Symbol, + bool MatchNonExported = false); + + /// Convenience version of blocking lookup. + /// Performs a single-symbol lookup, auto-interning the given symbol name. + Expected lookup(const JITDylibList &JDs, StringRef Symbol, + bool MatchNonExported = false); /// Materialize the given unit. void dispatchMaterialization(JITDylib &JD, @@ -873,16 +889,6 @@ Error JITDylib::define(std::unique_ptr &MU) { }); } -/// Look up the given names in the given JITDylibs. -/// JDs will be searched in order and no JITDylib pointer may be null. -/// All symbols must be found within the given JITDylibs or an error -/// will be returned. -Expected lookup(const JITDylibList &JDs, SymbolNameSet Names); - -/// Look up a symbol by searching a list of JITDylibs. -Expected lookup(const JITDylibList &JDs, - SymbolStringPtr Name); - /// Mangles symbol names then uniques them in the context of an /// ExecutionSession. class MangleAndInterner { diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp index 86a7eca..c9cface 100644 --- a/llvm/lib/ExecutionEngine/Orc/Core.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp @@ -646,7 +646,7 @@ void ReExportsMaterializationUnit::materialize( auto OnReady = [&ES](Error Err) { ES.reportError(std::move(Err)); }; ES.lookup({&SrcJD}, QuerySymbols, std::move(OnResolve), std::move(OnReady), - std::move(RegisterDependencies)); + std::move(RegisterDependencies), nullptr, true); } } @@ -1151,16 +1151,18 @@ SymbolNameSet JITDylib::lookupFlagsImpl(SymbolFlagsMap &Flags, void JITDylib::lodgeQuery(std::shared_ptr &Q, SymbolNameSet &Unresolved, + JITDylib *MatchNonExportedInJD, bool MatchNonExported, MaterializationUnitList &MUs) { assert(Q && "Query can not be null"); - lodgeQueryImpl(Q, Unresolved, MUs); + lodgeQueryImpl(Q, Unresolved, MatchNonExportedInJD, MatchNonExported, MUs); if (FallbackDefinitionGenerator && !Unresolved.empty()) { auto FallbackDefs = FallbackDefinitionGenerator(*this, Unresolved); if (!FallbackDefs.empty()) { for (auto &D : FallbackDefs) Unresolved.erase(D); - lodgeQueryImpl(Q, FallbackDefs, MUs); + lodgeQueryImpl(Q, FallbackDefs, MatchNonExportedInJD, MatchNonExported, + MUs); assert(FallbackDefs.empty() && "All fallback defs should have been found by lookupImpl"); } @@ -1169,6 +1171,7 @@ void JITDylib::lodgeQuery(std::shared_ptr &Q, void JITDylib::lodgeQueryImpl( std::shared_ptr &Q, SymbolNameSet &Unresolved, + JITDylib *MatchNonExportedInJD, bool MatchNonExported, std::vector> &MUs) { for (auto I = Unresolved.begin(), E = Unresolved.end(); I != E;) { auto TmpI = I++; @@ -1179,8 +1182,15 @@ void JITDylib::lodgeQueryImpl( if (SymI == Symbols.end()) continue; - // If we found Name in JD, remove it frome the Unresolved set and add it - // to the added set. + // If this is a non-exported symbol, then check the values of + // MatchNonExportedInJD and MatchNonExported. Skip if we should not match + // against this symbol. + if (!SymI->second.getFlags().isExported()) + if (!MatchNonExported && MatchNonExportedInJD != this) + continue; + + // If we matched against Name in JD, remove it frome the Unresolved set and + // add it to the added set. Unresolved.erase(TmpI); // If the symbol has an address then resolve it. @@ -1695,18 +1705,20 @@ Expected ExecutionSession::legacyLookup( #endif } -void ExecutionSession::lookup( - const JITDylibList &JDs, SymbolNameSet Symbols, - SymbolsResolvedCallback OnResolve, SymbolsReadyCallback OnReady, - RegisterDependenciesFunction RegisterDependencies) { +void ExecutionSession::lookup(const JITDylibList &JDs, SymbolNameSet Symbols, + SymbolsResolvedCallback OnResolve, + SymbolsReadyCallback OnReady, + RegisterDependenciesFunction RegisterDependencies, + JITDylib *MatchNonExportedInJD, + bool MatchNonExported) { // lookup can be re-entered recursively if running on a single thread. Run any - // outstanding MUs in case this query depends on them, otherwise the main - // thread will starve waiting for a result from an MU that it failed to run. + // outstanding MUs in case this query depends on them, otherwise this lookup + // will starve waiting for a result from an MU that is stuck in the queue. runOutstandingMUs(); auto Unresolved = std::move(Symbols); - std::map MUsMap; + std::map CollectedMUsMap; auto Q = std::make_shared( Unresolved, std::move(OnResolve), std::move(OnReady)); bool QueryIsFullyResolved = false; @@ -1716,9 +1728,10 @@ void ExecutionSession::lookup( runSessionLocked([&]() { for (auto *JD : JDs) { assert(JD && "JITDylibList entries must not be null"); - assert(!MUsMap.count(JD) && + assert(!CollectedMUsMap.count(JD) && "JITDylibList should not contain duplicate entries"); - JD->lodgeQuery(Q, Unresolved, MUsMap[JD]); + JD->lodgeQuery(Q, Unresolved, MatchNonExportedInJD, MatchNonExported, + CollectedMUsMap[JD]); } if (Unresolved.empty()) { @@ -1741,7 +1754,7 @@ void ExecutionSession::lookup( Q->detach(); // Replace the MUs. - for (auto &KV : MUsMap) + for (auto &KV : CollectedMUsMap) for (auto &MU : KV.second) KV.first->replace(std::move(MU)); } @@ -1761,7 +1774,7 @@ void ExecutionSession::lookup( { std::lock_guard Lock(OutstandingMUsMutex); - for (auto &KV : MUsMap) + for (auto &KV : CollectedMUsMap) for (auto &MU : KV.second) OutstandingMUs.push_back(std::make_pair(KV.first, std::move(MU))); } @@ -1772,7 +1785,8 @@ void ExecutionSession::lookup( Expected ExecutionSession::lookup(const JITDylibList &JDs, const SymbolNameSet &Symbols, RegisterDependenciesFunction RegisterDependencies, - bool WaitUntilReady) { + bool WaitUntilReady, JITDylib *MatchNonExportedInJD, + bool MatchNonExported) { #if LLVM_ENABLE_THREADS // In the threaded case we use promises to return the results. std::promise PromisedResult; @@ -1839,7 +1853,8 @@ ExecutionSession::lookup(const JITDylibList &JDs, const SymbolNameSet &Symbols, #endif // Perform the asynchronous lookup. - lookup(JDs, Symbols, OnResolve, OnReady, RegisterDependencies); + lookup(JDs, Symbols, OnResolve, OnReady, RegisterDependencies, + MatchNonExportedInJD, MatchNonExported); #if LLVM_ENABLE_THREADS auto ResultFuture = PromisedResult.get_future(); @@ -1882,6 +1897,27 @@ ExecutionSession::lookup(const JITDylibList &JDs, const SymbolNameSet &Symbols, #endif } +/// Look up a symbol by searching a list of JDs. +Expected ExecutionSession::lookup(const JITDylibList &JDs, + SymbolStringPtr Name, + bool MatchNonExported) { + SymbolNameSet Names({Name}); + + if (auto ResultMap = lookup(JDs, std::move(Names), NoDependenciesToRegister, + true, nullptr, MatchNonExported)) { + assert(ResultMap->size() == 1 && "Unexpected number of results"); + assert(ResultMap->count(Name) && "Missing result for symbol"); + return std::move(ResultMap->begin()->second); + } else + return ResultMap.takeError(); +} + +Expected ExecutionSession::lookup(const JITDylibList &JDs, + StringRef Name, + bool MatchNonExported) { + return lookup(JDs, intern(Name), MatchNonExported); +} + void ExecutionSession::dump(raw_ostream &OS) { runSessionLocked([this, &OS]() { for (auto &JD : JDs) @@ -1910,28 +1946,6 @@ void ExecutionSession::runOutstandingMUs() { } } -Expected lookup(const JITDylibList &JDs, SymbolNameSet Names) { - - if (JDs.empty()) - return SymbolMap(); - - auto &ES = (*JDs.begin())->getExecutionSession(); - - return ES.lookup(JDs, Names, NoDependenciesToRegister, true); -} - -/// Look up a symbol by searching a list of JDs. -Expected lookup(const JITDylibList &JDs, - SymbolStringPtr Name) { - SymbolNameSet Names({Name}); - if (auto ResultMap = lookup(JDs, std::move(Names))) { - assert(ResultMap->size() == 1 && "Unexpected number of results"); - assert(ResultMap->count(Name) && "Missing result for symbol"); - return std::move(ResultMap->begin()->second); - } else - return ResultMap.takeError(); -} - MangleAndInterner::MangleAndInterner(ExecutionSession &ES, const DataLayout &DL) : ES(ES), DL(DL) {} diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp index 47cb273..6a18010 100644 --- a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp @@ -128,7 +128,10 @@ Error CtorDtorRunner2::run() { } } - if (auto CtorDtorMap = lookup({&JD}, std::move(Names))) { + auto &ES = JD.getExecutionSession(); + if (auto CtorDtorMap = + ES.lookup({&JD}, std::move(Names), NoDependenciesToRegister, true, + nullptr, true)) { for (auto &KV : CtorDtorsByPriority) { for (auto &Name : KV.second) { assert(CtorDtorMap->count(Name) && "No entry for Name"); diff --git a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp index d7fd57b..6bc33c9 100644 --- a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp +++ b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp @@ -99,9 +99,10 @@ JITTargetAddress JITCompileCallbackManager::executeCompileCallback( Name = I->second; } - if (auto Sym = lookup({&CallbacksJD}, Name)) + if (auto Sym = ES.lookup({&CallbacksJD}, Name, true)) return Sym->getAddress(); else { + llvm::dbgs() << "Didn't find callback.\n"; // If anything goes wrong materializing Sym then report it to the session // and return the ErrorHandlerAddress; ES.reportError(Sym.takeError()); diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp index 47baa45..39bb4c4 100644 --- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp +++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp @@ -78,7 +78,7 @@ Error LLJIT::addObjectFile(JITDylib &JD, std::unique_ptr Obj) { Expected LLJIT::lookupLinkerMangled(JITDylib &JD, StringRef Name) { - return llvm::orc::lookup({&JD}, ES->intern(Name)); + return ES->lookup({&JD}, ES->intern(Name)); } LLJIT::LLJIT(std::unique_ptr ES, diff --git a/llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp b/llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp index 0d80491..1cce0c6c 100644 --- a/llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp +++ b/llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp @@ -52,8 +52,8 @@ LazyCallThroughManager::callThroughToSymbol(JITTargetAddress TrampolineAddr) { SymbolName = I->second.second; } - auto LookupResult = - ES.lookup({SourceJD}, {SymbolName}, NoDependenciesToRegister); + auto LookupResult = ES.lookup({SourceJD}, {SymbolName}, + NoDependenciesToRegister, true, nullptr, true); if (!LookupResult) { ES.reportError(LookupResult.takeError()); diff --git a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp index a2c4a2f..e84295c 100644 --- a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp @@ -52,7 +52,7 @@ public: MR.getTargetJITDylib().withSearchOrderDo([&](const JITDylibList &JDs) { ES.lookup(JDs, InternedSymbols, OnResolvedWithUnwrap, OnReady, - RegisterDependencies); + RegisterDependencies, &MR.getTargetJITDylib()); }); } diff --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp index cd74218..c8fa6ef 100644 --- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp @@ -220,6 +220,24 @@ TEST_F(CoreAPIsStandardTest, ChainedJITDylibLookup) { EXPECT_TRUE(OnReadyRun) << "OnReady was not run for empty query"; } +TEST_F(CoreAPIsStandardTest, LookupWithHiddenSymbols) { + auto BarHiddenFlags = BarSym.getFlags() & ~JITSymbolFlags::Exported; + auto BarHiddenSym = JITEvaluatedSymbol(BarSym.getAddress(), BarHiddenFlags); + + cantFail(JD.define(absoluteSymbols({{Foo, FooSym}, {Bar, BarHiddenSym}}))); + + auto &JD2 = ES.createJITDylib("JD2"); + cantFail(JD2.define(absoluteSymbols({{Bar, QuxSym}}))); + + auto Result = cantFail(ES.lookup({&JD, &JD2}, {Foo, Bar})); + + EXPECT_EQ(Result.size(), 2U) << "Unexpected number of results"; + EXPECT_EQ(Result.count(Foo), 1U) << "Missing result for \"Foo\""; + EXPECT_EQ(Result.count(Bar), 1U) << "Missing result for \"Bar\""; + EXPECT_EQ(Result[Bar].getAddress(), QuxSym.getAddress()) + << "Wrong result for \"Bar\""; +} + TEST_F(CoreAPIsStandardTest, LookupFlagsTest) { // Test that lookupFlags works on a predefined symbol, and does not trigger // materialization of a lazy symbol. Make the lazy symbol weak to test that @@ -257,7 +275,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicAliases) { {Qux, {Bar, JITSymbolFlags::Weak}}}))); cantFail(JD.define(absoluteSymbols({{Qux, QuxSym}}))); - auto Result = lookup({&JD}, {Baz, Qux}); + auto Result = ES.lookup({&JD}, {Baz, Qux}); EXPECT_TRUE(!!Result) << "Unexpected lookup failure"; EXPECT_EQ(Result->count(Baz), 1U) << "No result for \"baz\""; EXPECT_EQ(Result->count(Qux), 1U) << "No result for \"qux\""; @@ -272,7 +290,7 @@ TEST_F(CoreAPIsStandardTest, TestChainedAliases) { cantFail(JD.define(symbolAliases( {{Baz, {Bar, BazSym.getFlags()}}, {Bar, {Foo, BarSym.getFlags()}}}))); - auto Result = lookup({&JD}, {Bar, Baz}); + auto Result = ES.lookup({&JD}, {Bar, Baz}); EXPECT_TRUE(!!Result) << "Unexpected lookup failure"; EXPECT_EQ(Result->count(Bar), 1U) << "No result for \"bar\""; EXPECT_EQ(Result->count(Baz), 1U) << "No result for \"baz\""; @@ -291,7 +309,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicReExports) { cantFail(JD2.define(reexports(JD, {{Bar, {Foo, BarSym.getFlags()}}}))); - auto Result = cantFail(lookup({&JD2}, Bar)); + auto Result = cantFail(ES.lookup({&JD2}, Bar)); EXPECT_EQ(Result.getAddress(), FooSym.getAddress()) << "Re-export Bar for symbol Foo should match FooSym's address"; } @@ -317,7 +335,7 @@ TEST_F(CoreAPIsStandardTest, TestThatReExportsDontUnnecessarilyMaterialize) { cantFail(JD2.define(reexports( JD, {{Baz, {Foo, BazSym.getFlags()}}, {Qux, {Bar, QuxSym.getFlags()}}}))); - auto Result = cantFail(lookup({&JD2}, Baz)); + auto Result = cantFail(ES.lookup({&JD2}, Baz)); EXPECT_EQ(Result.getAddress(), FooSym.getAddress()) << "Re-export Baz for symbol Foo should match FooSym's address"; @@ -340,7 +358,7 @@ TEST_F(CoreAPIsStandardTest, TestReexportsFallbackGenerator) { EXPECT_EQ(Flags.size(), 1U) << "Unexpected number of results"; EXPECT_EQ(Flags[Foo], FooSym.getFlags()) << "Unexpected flags for Foo"; - auto Result = cantFail(lookup({&JD}, Foo)); + auto Result = cantFail(ES.lookup({&JD}, Foo)); EXPECT_EQ(Result.getAddress(), FooSym.getAddress()) << "Incorrect reexported symbol address"; @@ -650,13 +668,13 @@ TEST_F(CoreAPIsStandardTest, DefineMaterializingSymbol) { }); cantFail(JD.define(MU)); - cantFail(lookup({&JD}, Foo)); + cantFail(ES.lookup({&JD}, Foo)); // Assert that materialization is complete by now. ExpectNoMoreMaterialization = true; // Look up bar to verify that no further materialization happens. - auto BarResult = cantFail(lookup({&JD}, Bar)); + auto BarResult = cantFail(ES.lookup({&JD}, Bar)); EXPECT_EQ(BarResult.getAddress(), BarSym.getAddress()) << "Expected Bar == BarSym"; } @@ -670,7 +688,7 @@ TEST_F(CoreAPIsStandardTest, FallbackDefinitionGeneratorTest) { return SymbolNameSet({Bar}); }); - auto Result = cantFail(lookup({&JD}, {Foo, Bar})); + auto Result = cantFail(ES.lookup({&JD}, {Foo, Bar})); EXPECT_EQ(Result.count(Bar), 1U) << "Expected to find fallback def for 'bar'"; EXPECT_EQ(Result[Bar].getAddress(), BarSym.getAddress()) @@ -679,14 +697,14 @@ TEST_F(CoreAPIsStandardTest, FallbackDefinitionGeneratorTest) { TEST_F(CoreAPIsStandardTest, FailResolution) { auto MU = llvm::make_unique( - SymbolFlagsMap( - {{Foo, JITSymbolFlags::Weak}, {Bar, JITSymbolFlags::Weak}}), + SymbolFlagsMap({{Foo, JITSymbolFlags::Exported | JITSymbolFlags::Weak}, + {Bar, JITSymbolFlags::Exported | JITSymbolFlags::Weak}}), [&](MaterializationResponsibility R) { R.failMaterialization(); }); cantFail(JD.define(MU)); SymbolNameSet Names({Foo, Bar}); - auto Result = lookup({&JD}, Names); + auto Result = ES.lookup({&JD}, Names); EXPECT_FALSE(!!Result) << "Expected failure"; if (!Result) { @@ -718,7 +736,7 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithUnthreadedMaterialization) { cantFail(JD.define(MU)); - auto FooLookupResult = cantFail(lookup({&JD}, Foo)); + auto FooLookupResult = cantFail(ES.lookup({&JD}, Foo)); EXPECT_EQ(FooLookupResult.getAddress(), FooSym.getAddress()) << "lookup returned an incorrect address"; @@ -739,7 +757,7 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithThreadedMaterialization) { cantFail(JD.define(absoluteSymbols({{Foo, FooSym}}))); - auto FooLookupResult = cantFail(lookup({&JD}, Foo)); + auto FooLookupResult = cantFail(ES.lookup({&JD}, Foo)); EXPECT_EQ(FooLookupResult.getAddress(), FooSym.getAddress()) << "lookup returned an incorrect address"; @@ -787,14 +805,14 @@ TEST_F(CoreAPIsStandardTest, TestGetRequestedSymbolsAndReplace) { EXPECT_FALSE(FooMaterialized) << "Foo should not be materialized yet"; EXPECT_FALSE(BarMaterialized) << "Bar should not be materialized yet"; - auto FooSymResult = cantFail(lookup({&JD}, Foo)); + auto FooSymResult = cantFail(ES.lookup({&JD}, Foo)); EXPECT_EQ(FooSymResult.getAddress(), FooSym.getAddress()) << "Address mismatch for Foo"; EXPECT_TRUE(FooMaterialized) << "Foo should be materialized now"; EXPECT_FALSE(BarMaterialized) << "Bar still should not be materialized"; - auto BarSymResult = cantFail(lookup({&JD}, Bar)); + auto BarSymResult = cantFail(ES.lookup({&JD}, Bar)); EXPECT_EQ(BarSymResult.getAddress(), BarSym.getAddress()) << "Address mismatch for Bar"; EXPECT_TRUE(BarMaterialized) << "Bar should be materialized now"; @@ -814,7 +832,7 @@ TEST_F(CoreAPIsStandardTest, TestMaterializationResponsibilityDelegation) { cantFail(JD.define(MU)); - auto Result = lookup({&JD}, {Foo, Bar}); + auto Result = ES.lookup({&JD}, {Foo, Bar}); EXPECT_TRUE(!!Result) << "Result should be a success value"; EXPECT_EQ(Result->count(Foo), 1U) << "\"Foo\" entry missing"; @@ -865,14 +883,4 @@ TEST_F(CoreAPIsStandardTest, TestMaterializeWeakSymbol) { FooResponsibility->emit(); } -TEST_F(CoreAPIsStandardTest, TestMainJITDylibAndDefaultLookupOrder) { - cantFail(ES.getMainJITDylib().define(absoluteSymbols({{Foo, FooSym}}))); - auto Results = cantFail(ES.lookup({Foo})); - - EXPECT_EQ(Results.size(), 1U) << "Incorrect number of results"; - EXPECT_EQ(Results.count(Foo), 1U) << "Expected result for 'Foo'"; - EXPECT_EQ(Results[Foo].getAddress(), FooSym.getAddress()) - << "Expected result address to match Foo's address"; -} - } // namespace -- 2.7.4