1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

Revert "[llvm-jitlink] Don't demote unreferenced definitions in -harness mode."

This reverts commit e137b550587a85b0d9c9c539edc79de0122b6946.

This commit broke a test case. Reverting while I investigate.
This commit is contained in:
Lang Hames 2020-08-13 11:44:42 -07:00
parent e9e70ce1dd
commit 82307c21a7

View File

@ -187,7 +187,7 @@ static Error applyHarnessPromotions(Session &S, LinkGraph &G) {
// If this graph is part of the test then promote any symbols referenced by
// the harness to default scope, remove all symbols that clash with harness
// definitions.
// definitions, demote all other definitions.
std::vector<Symbol *> DefinitionsToRemove;
for (auto *Sym : G.defined_symbols()) {
@ -219,6 +219,10 @@ static Error applyHarnessPromotions(Session &S, LinkGraph &G) {
} else if (S.HarnessDefinitions.count(Sym->getName())) {
LLVM_DEBUG(dbgs() << " Externalizing " << Sym->getName() << "\n");
DefinitionsToRemove.push_back(Sym);
} else {
LLVM_DEBUG(dbgs() << " Demoting " << Sym->getName() << "\n");
Sym->setScope(Scope::Local);
Sym->setLive(false);
}
}
@ -517,8 +521,7 @@ Error LLVMJITLinkObjectLinkingLayer::add(JITDylib &JD,
return SymFlagsOrErr.takeError();
// Skip symbols not defined in this object file.
if ((*SymFlagsOrErr & object::BasicSymbolRef::SF_Undefined) ||
!(*SymFlagsOrErr & object::BasicSymbolRef::SF_Global))
if (*SymFlagsOrErr & object::BasicSymbolRef::SF_Undefined)
continue;
auto Name = Sym.getName();
@ -548,8 +551,10 @@ Error LLVMJITLinkObjectLinkingLayer::add(JITDylib &JD,
*SymFlags &= ~JITSymbolFlags::Exported;
} else if (S.HarnessExternals.count(*Name)) {
*SymFlags |= JITSymbolFlags::Exported;
} else if (S.HarnessDefinitions.count(*Name))
} else {
// Skip symbols that aren't in the HarnessExternals set.
continue;
}
auto InternedName = S.ES.intern(*Name);
SymbolFlags[InternedName] = std::move(*SymFlags);