summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/Orc
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-08-08 22:53:37 +0000
committerLang Hames <lhames@gmail.com>2016-08-08 22:53:37 +0000
commitfbda7015e7a2fe22a5925e8b6a1126ff0ec14ce1 (patch)
tree75b8a08018c0fef5b1f19d1bcbe145e3f1d891b6 /lib/ExecutionEngine/Orc
parentd77fdcbf640623ef0805ffee65b547d25cab9271 (diff)
[RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.
This patch causes RuntimeDyld to check for existing definitions when it encounters weak symbols. If a definition already exists then the new weak definition is discarded. All symbol lookups within a "logical dylib" should now agree on the address of any given weak symbol. This allows the JIT to better match the behavior of the static linker for C++ code. This support is only partial, as it does not allow strong definitions that occur after the first weak definition (in JIT symbol lookup order) to override the previous weak definitions. Support for this will be added in a future patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278065 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Orc')
-rw-r--r--lib/ExecutionEngine/Orc/OrcMCJITReplacement.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
index 805852b4887..db9c519b826 100644
--- a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
+++ b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
@@ -116,11 +116,13 @@ class OrcMCJITReplacement : public ExecutionEngine {
LinkingResolver(OrcMCJITReplacement &M) : M(M) {}
JITSymbol findSymbol(const std::string &Name) override {
- return M.findMangledSymbol(Name);
+ return M.ClientResolver->findSymbol(Name);
}
JITSymbol findSymbolInLogicalDylib(const std::string &Name) override {
- return M.ClientResolver->findSymbol(Name);
+ if (auto Sym = M.findMangledSymbol(Name))
+ return Sym;
+ return M.ClientResolver->findSymbolInLogicalDylib(Name);
}
private: