aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2024-09-22 18:17:14 +1000
committerLang Hames <lhames@gmail.com>2024-09-22 18:51:17 +1000
commit0074cea432e268ed126b12c6e7fd4df2e1707a77 (patch)
tree435e7b3f76b8503c6722c10869d62394e3215868 /llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
parente4e3ff5adc8b374be0620223ea2b654adde038ea (diff)
downloadllvm-0074cea432e268ed126b12c6e7fd4df2e1707a77.zip
llvm-0074cea432e268ed126b12c6e7fd4df2e1707a77.tar.gz
llvm-0074cea432e268ed126b12c6e7fd4df2e1707a77.tar.bz2
[ORC] Get rid of ObjectLinkingLayer::Plugin::getSyntheticSymbolDependencies.
Instead, when a MaterializationResponsibility contains an initializer symbol, the Platform classes (MachO, COFF, ELFNix) will now add a defined symbol with the same name to an arbitary block within the initializer sections, and then add keep-alive edges from that symbol to all other init section blocks. ObjectLinkingLayer is updated to automatically discard symbols where the corresponding MaterializationResponsibility entry has the MaterializationSideEffecstsOnly flag. This change simplifies both the ObjectLinkingLayer::Plugin interface and the dependence tracking algorithm, which no longer needs a special case for "synthetic" (MaterializationSideEffectsOnly) symbols.
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
index 19d8307..25ab154 100644
--- a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
@@ -275,24 +275,22 @@ public:
// First check that there aren't any missing symbols.
size_t NumMaterializationSideEffectsOnlySymbols = 0;
- SymbolNameVector ExtraSymbols;
SymbolNameVector MissingSymbols;
- for (auto &KV : MR->getSymbols()) {
+ for (auto &[Sym, Flags] : MR->getSymbols()) {
- auto I = InternedResult.find(KV.first);
+ auto I = InternedResult.find(Sym);
// 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()) {
+ // the counter and remove in from the result, otherwise make sure that
+ // it's defined.
+ if (Flags.hasMaterializationSideEffectsOnly()) {
++NumMaterializationSideEffectsOnlySymbols;
- if (I != InternedResult.end())
- ExtraSymbols.push_back(KV.first);
+ InternedResult.erase(Sym);
continue;
} else if (I == InternedResult.end())
- MissingSymbols.push_back(KV.first);
+ MissingSymbols.push_back(Sym);
else if (Layer.OverrideObjectFlags)
- I->second.setFlags(KV.second);
+ I->second.setFlags(Flags);
}
// If there were missing symbols then report the error.
@@ -303,6 +301,7 @@ public:
// If there are more definitions than expected, add them to the
// ExtraSymbols vector.
+ SymbolNameVector ExtraSymbols;
if (InternedResult.size() >
MR->getSymbols().size() - NumMaterializationSideEffectsOnlySymbols) {
for (auto &KV : InternedResult)