aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2021-12-16 17:55:02 +1100
committerLang Hames <lhames@gmail.com>2021-12-16 19:46:51 +1100
commit02fc8d5c9eb0703bb1863f22c2d27ff7a580f537 (patch)
treea3cb0ad653509622b8ceba845a75de2794e956ab /llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
parent3eeeb6ec933366a1b4d5482f07ddc724001a6079 (diff)
downloadllvm-02fc8d5c9eb0703bb1863f22c2d27ff7a580f537.zip
llvm-02fc8d5c9eb0703bb1863f22c2d27ff7a580f537.tar.gz
llvm-02fc8d5c9eb0703bb1863f22c2d27ff7a580f537.tar.bz2
[ORC] Add custom object interface support to StaticLibaryDefinitionGenerator.
This adds a GetObjectFileInterface callback member to StaticLibraryDefinitionGenerator, and adds an optional argument for initializing that member to StaticLibraryDefinitionGenerator's named constructors. If not supplied, it will default to getObjectFileInterface from ObjectFileInterface.h. To enable testing a `-hidden-l<x>` option is added to the llvm-jitlink tool. This allows archives to be loaded with all contained symbol visibilities demoted to hidden. The ObjectLinkingLayer::setOverrideObjectFlagsWithResponsibilityFlags method is (belatedly) hooked up, and enabled in llvm-jitlink when `-hidden-l<x>` is used so that the demotion is also applied at symbol resolution time (avoiding any "mismatched symbol flags" crashes).
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
index a6d3ca7..0d6a33c 100644
--- a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
@@ -249,7 +249,8 @@ public:
{
- // Check that InternedResult matches up with MR->getSymbols().
+ // Check that InternedResult matches up with MR->getSymbols(), overriding
+ // flags if requested.
// This guards against faulty transformations / compilers / object caches.
// First check that there aren't any missing symbols.
@@ -258,16 +259,20 @@ public:
SymbolNameVector MissingSymbols;
for (auto &KV : MR->getSymbols()) {
+ auto I = InternedResult.find(KV.first);
+
// If this is a materialization-side-effects only symbol then bump
// the counter and make sure it's *not* defined, otherwise make
// sure that it is defined.
if (KV.second.hasMaterializationSideEffectsOnly()) {
++NumMaterializationSideEffectsOnlySymbols;
- if (InternedResult.count(KV.first))
+ if (I != InternedResult.end())
ExtraSymbols.push_back(KV.first);
continue;
- } else if (!InternedResult.count(KV.first))
+ } else if (I == InternedResult.end())
MissingSymbols.push_back(KV.first);
+ else if (Layer.OverrideObjectFlags)
+ I->second.setFlags(KV.second);
}
// If there were missing symbols then report the error.