[PATCH] D75087: [ORC] Add LookupKind::TransitiveStatic for linker-resolved transitive dependencies
Stefan Gränitz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 15:15:28 PST 2020
sgraenitz created this revision.
sgraenitz added a reviewer: lhames.
Herald added subscribers: dexonsmith, steven_wu, hiraditya.
Herald added a project: LLVM.
This lookup kind tells symbol generators that the lookup is being performed for transitive module dependencies. ThinLtoJIT wants to avoid loading and emitting modules for transitive dependencies where possible (if all requested symbols for one module are callable) and instead emit synthetic call-through stubs, which will load and emit the module when reached.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75087
Files:
llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
llvm/include/llvm/ExecutionEngine/Orc/Core.h
llvm/lib/ExecutionEngine/Orc/Core.cpp
llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
Index: llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
+++ llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
@@ -50,7 +50,7 @@
JITDylibSearchOrder SearchOrder;
MR.getTargetJITDylib().withSearchOrderDo(
[&](const JITDylibSearchOrder &JDs) { SearchOrder = JDs; });
- ES.lookup(LookupKind::Static, SearchOrder, InternedSymbols,
+ ES.lookup(LookupKind::TransitiveStatic, SearchOrder, InternedSymbols,
SymbolState::Resolved, std::move(OnResolvedWithUnwrap),
RegisterDependencies);
}
Index: llvm/lib/ExecutionEngine/Orc/Core.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -225,6 +225,8 @@
return OS << "Static";
case LookupKind::DLSym:
return OS << "DLSym";
+ case LookupKind::TransitiveStatic:
+ return OS << "TransitiveStatic";
}
llvm_unreachable("Invalid lookup kind");
}
Index: llvm/include/llvm/ExecutionEngine/Orc/Core.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/Orc/Core.h
+++ llvm/include/llvm/ExecutionEngine/Orc/Core.h
@@ -86,7 +86,7 @@
///
/// DLSym -- Lookup is being performed as-if at runtime (e.g. generators
/// representing static archives should not pull in new definitions).
-enum class LookupKind { Static, DLSym };
+enum class LookupKind { Static, DLSym, TransitiveStatic };
/// A list of (JITDylib*, JITDylibLookupFlags) pairs to be used as a search
/// order during symbol lookup.
Index: llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
===================================================================
--- llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
+++ llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
@@ -362,9 +362,13 @@
ModuleNames RemainingPaths;
for (auto &KV : ModuleInfoMap) {
StringRef Path = KV.first();
- // TODO: Allow to distinguish regular static lookups from lookups for
- // transitive dependencies issued by the linker.
- RemainingPaths.push_back(Path);
+ ModuleInfo &MI = KV.second;
+ if (K == LookupKind::TransitiveStatic && MI.AllCallable) {
+ if (Error Err = submitCallThroughStubs(Path, std::move(MI)))
+ return Err;
+ } else {
+ RemainingPaths.push_back(Path);
+ }
}
// For direct requests and transitive data dependencies, emit reexports.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75087.246323.patch
Type: text/x-patch
Size: 2540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200224/246598d8/attachment.bin>
More information about the llvm-commits
mailing list