summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-05-25 16:23:59 +0000
committerLang Hames <lhames@gmail.com>2016-05-25 16:23:59 +0000
commitbf9d1aa9310dd3fbb53b885469cdf3dc87e85480 (patch)
treeebd7b3b7aefb46c60f8e57a062b5618a44672f66 /llvm/lib/ExecutionEngine/RuntimeDyld
parenta00df49dc5c1d94b04e9c4271018c6aaa97d7426 (diff)
downloadbcm5719-llvm-bf9d1aa9310dd3fbb53b885469cdf3dc87e85480.tar.gz
bcm5719-llvm-bf9d1aa9310dd3fbb53b885469cdf3dc87e85480.zip
[RuntimeDyld] Call the SymbolResolver::findSymbolInLogicalDylib method when
searching for external symbols, and fall back to the SymbolResolver::findSymbol method if the former returns null. This makes RuntimeDyld behave more like a static linker: Symbol definitions from within the current module's "logical dylib" will be preferred to external definitions. We can build on this behavior in the future to properly support weak symbol handling. Custom symbol resolvers that override the findSymbolInLogicalDylib method may notice changes due to this patch. Clients who have not overridden this method should generally be unaffected, however users of the OrcMCJITReplacement class may notice changes. llvm-svn: 270716
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index 2df35da7bf1..4a282cb66e5 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -916,7 +916,11 @@ void RuntimeDyldImpl::resolveExternalSymbols() {
if (Loc == GlobalSymbolTable.end()) {
// This is an external symbol, try to get its address from the symbol
// resolver.
- Addr = Resolver.findSymbol(Name.data()).getAddress();
+ // First search for the symbol in this logical dylib.
+ Addr = Resolver.findSymbolInLogicalDylib(Name.data()).getAddress();
+ // If that fails, try searching for an external symbol.
+ if (!Addr)
+ Addr = Resolver.findSymbol(Name.data()).getAddress();
// The call to getSymbolAddress may have caused additional modules to
// be loaded, which may have added new entries to the
// ExternalSymbolRelocations map. Consquently, we need to update our
OpenPOWER on IntegriCloud