Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | static bool testSetProcessAllSections(std::unique_ptr<MemoryBuffer> Obj, | ||||
auto &JD = ES.createJITDylib("main"); | auto &JD = ES.createJITDylib("main"); | ||||
auto Foo = ES.intern("foo"); | auto Foo = ES.intern("foo"); | ||||
RTDyldObjectLinkingLayer ObjLayer(ES, [&DebugSectionSeen]() { | RTDyldObjectLinkingLayer ObjLayer(ES, [&DebugSectionSeen]() { | ||||
return std::make_unique<MemoryManagerWrapper>(DebugSectionSeen); | return std::make_unique<MemoryManagerWrapper>(DebugSectionSeen); | ||||
}); | }); | ||||
auto OnResolveDoNothing = [](Expected<SymbolMap> R) { | auto OnResolveDoNothing = [](Expected<SymbolMap> R) { | ||||
cantFail(std::move(R)); | llvm_cantFail(std::move(R)); | ||||
}; | }; | ||||
ObjLayer.setProcessAllSections(ProcessAllSections); | ObjLayer.setProcessAllSections(ProcessAllSections); | ||||
cantFail(ObjLayer.add(JD, std::move(Obj), ES.allocateVModule())); | llvm_cantFail(ObjLayer.add(JD, std::move(Obj), ES.allocateVModule())); | ||||
ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo}, SymbolState::Resolved, | ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo}, SymbolState::Resolved, | ||||
OnResolveDoNothing, NoDependenciesToRegister); | OnResolveDoNothing, NoDependenciesToRegister); | ||||
return DebugSectionSeen; | return DebugSectionSeen; | ||||
} | } | ||||
TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) { | TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) { | ||||
LLVMContext Context; | LLVMContext Context; | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) { | ||||
auto &JD = ES.createJITDylib("main"); | auto &JD = ES.createJITDylib("main"); | ||||
auto Foo = ES.intern("foo"); | auto Foo = ES.intern("foo"); | ||||
RTDyldObjectLinkingLayer ObjLayer( | RTDyldObjectLinkingLayer ObjLayer( | ||||
ES, []() { return std::make_unique<SectionMemoryManager>(); }); | ES, []() { return std::make_unique<SectionMemoryManager>(); }); | ||||
IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM)); | IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM)); | ||||
ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true); | ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true); | ||||
cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule())); | llvm_cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule())); | ||||
ES.lookup( | ES.lookup( | ||||
JITDylibSearchList({{&JD, false}}), {Foo}, SymbolState::Resolved, | JITDylibSearchList({{&JD, false}}), {Foo}, SymbolState::Resolved, | ||||
[](Expected<SymbolMap> R) { cantFail(std::move(R)); }, | [](Expected<SymbolMap> R) { llvm_cantFail(std::move(R)); }, | ||||
NoDependenciesToRegister); | NoDependenciesToRegister); | ||||
} | } | ||||
TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) { | TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) { | ||||
OrcNativeTarget::initialize(); | OrcNativeTarget::initialize(); | ||||
std::unique_ptr<TargetMachine> TM( | std::unique_ptr<TargetMachine> TM( | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) { | ||||
auto &JD = ES.createJITDylib("main"); | auto &JD = ES.createJITDylib("main"); | ||||
auto Foo = ES.intern("foo"); | auto Foo = ES.intern("foo"); | ||||
RTDyldObjectLinkingLayer ObjLayer( | RTDyldObjectLinkingLayer ObjLayer( | ||||
ES, []() { return std::make_unique<SectionMemoryManager>(); }); | ES, []() { return std::make_unique<SectionMemoryManager>(); }); | ||||
IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM)); | IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM)); | ||||
ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true); | ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true); | ||||
cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule())); | llvm_cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule())); | ||||
ES.lookup( | ES.lookup( | ||||
JITDylibSearchList({{&JD, false}}), {Foo}, SymbolState::Resolved, | JITDylibSearchList({{&JD, false}}), {Foo}, SymbolState::Resolved, | ||||
[](Expected<SymbolMap> R) { cantFail(std::move(R)); }, | [](Expected<SymbolMap> R) { llvm_cantFail(std::move(R)); }, | ||||
NoDependenciesToRegister); | NoDependenciesToRegister); | ||||
} | } | ||||
} // end anonymous namespace | } // end anonymous namespace |