Revert "[ORC][JITLink] Add jitlink::Scope::SideEffectsOnly, use it in ORC Platforms."

This reverts commit aba6bb0820 while I investigate bot
failures (e.g. https://lab.llvm.org/buildbot/#/builders/143/builds/3848)
This commit is contained in:
Lang Hames
2024-12-03 16:56:23 +11:00
parent aba6bb0820
commit 28e2a89121
5 changed files with 11 additions and 14 deletions

View File

@@ -393,13 +393,10 @@ const char *getLinkageName(Linkage L);
/// Defines the scope in which this symbol should be visible:
/// Default -- Visible in the public interface of the linkage unit.
/// Hidden -- Visible within the linkage unit, but not exported from it.
/// SideEffectsOnly -- Like hidden, but symbol can only be looked up once
/// to trigger materialization of the containing graph.
/// Local -- Visible only within the LinkGraph.
enum class Scope : uint8_t {
Default,
Hidden,
SideEffectsOnly,
Local
};

View File

@@ -76,7 +76,7 @@ public:
// Init symbol is __ImageBase symbol.
auto &ImageBaseSymbol = G->addDefinedSymbol(
HeaderBlock, 0, *R->getInitializerSymbol(), HeaderBlock.getSize(),
jitlink::Linkage::Strong, jitlink::Scope::SideEffectsOnly, false, true);
jitlink::Linkage::Strong, jitlink::Scope::Default, false, true);
addImageBaseRelocationEdge(HeaderBlock, ImageBaseSymbol);

View File

@@ -197,7 +197,7 @@ public:
8, 0);
auto &DSOHandleSymbol = G->addDefinedSymbol(
DSOHandleBlock, 0, *R->getInitializerSymbol(), DSOHandleBlock.getSize(),
jitlink::Linkage::Strong, jitlink::Scope::SideEffectsOnly, false, true);
jitlink::Linkage::Strong, jitlink::Scope::Default, false, true);
DSOHandleBlock.addEdge(EdgeKind, 0, DSOHandleSymbol, 0);
ENP.getObjectLinkingLayer().emit(std::move(R), std::move(G));

View File

@@ -1001,9 +1001,9 @@ Error MachOPlatform::MachOPlatformPlugin::preserveImportantSections(
// to the first block.
if (!InitSym) {
auto &B = **InitSection->blocks().begin();
InitSym = &G.addDefinedSymbol(
B, 0, *InitSymName, B.getSize(), jitlink::Linkage::Strong,
jitlink::Scope::SideEffectsOnly, false, true);
InitSym = &G.addDefinedSymbol(B, 0, *InitSymName, B.getSize(),
jitlink::Linkage::Strong,
jitlink::Scope::Default, false, true);
}
// Add keep-alive edges to anonymous symbols in all other init blocks.

View File

@@ -65,8 +65,6 @@ JITSymbolFlags getJITSymbolFlagsForSymbol(Symbol &Sym) {
if (Sym.getScope() == Scope::Default)
Flags |= JITSymbolFlags::Exported;
else if (Sym.getScope() == Scope::SideEffectsOnly)
Flags |= JITSymbolFlags::MaterializationSideEffectsOnly;
if (Sym.isCallable())
Flags |= JITSymbolFlags::Callable;
@@ -238,7 +236,7 @@ public:
SymbolMap InternedResult;
for (auto *Sym : G.defined_symbols())
if (Sym->getScope() < Scope::SideEffectsOnly) {
if (Sym->getScope() != Scope::Local) {
auto InternedName = ES.intern(Sym->getName());
auto Ptr = getJITSymbolPtrForSymbol(*Sym, G.getTargetTriple());
auto Flags = getJITSymbolFlagsForSymbol(*Sym);
@@ -251,7 +249,7 @@ public:
}
for (auto *Sym : G.absolute_symbols())
if (Sym->getScope() < Scope::SideEffectsOnly) {
if (Sym->getScope() != Scope::Local) {
auto InternedName = ES.intern(Sym->getName());
auto Ptr = getJITSymbolPtrForSymbol(*Sym, G.getTargetTriple());
auto Flags = getJITSymbolFlagsForSymbol(*Sym);
@@ -283,9 +281,11 @@ public:
// If this is a materialization-side-effects only symbol then bump
// the counter and remove in from the result, otherwise make sure that
// it's defined.
if (Flags.hasMaterializationSideEffectsOnly())
if (Flags.hasMaterializationSideEffectsOnly()) {
++NumMaterializationSideEffectsOnlySymbols;
else if (I == InternedResult.end())
InternedResult.erase(Sym);
continue;
} else if (I == InternedResult.end())
MissingSymbols.push_back(Sym);
else if (Layer.OverrideObjectFlags)
I->second.setFlags(Flags);