forked from OSchip/llvm-project
[ORC] Skip ST_File symbols in MaterializationUnit interfaces / resolution.
ST_File symbols aren't relevant for linking purposes, but can end up shadowing real symbols if they're not filtered. No test case yet: The ideal testcase for this would be an ELF llvm-jitlink test, but llvm-jitlink support for ELF is still under development. We should add a testcase for this once support lands in tree.
This commit is contained in:
parent
6f5d5d6602
commit
31e0331763
|
@ -99,6 +99,13 @@ getObjectSymbolInfo(ExecutionSession &ES, MemoryBufferRef ObjBuffer) {
|
||||||
if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global))
|
if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Skip symbols that have type SF_File.
|
||||||
|
if (auto SymType = Sym.getType()) {
|
||||||
|
if (*SymType == object::SymbolRef::ST_File)
|
||||||
|
continue;
|
||||||
|
} else
|
||||||
|
return SymType.takeError();
|
||||||
|
|
||||||
auto Name = Sym.getName();
|
auto Name = Sym.getName();
|
||||||
if (!Name)
|
if (!Name)
|
||||||
return Name.takeError();
|
return Name.takeError();
|
||||||
|
|
|
@ -116,6 +116,18 @@ void RTDyldObjectLinkingLayer::emit(MaterializationResponsibility R,
|
||||||
auto InternalSymbols = std::make_shared<std::set<StringRef>>();
|
auto InternalSymbols = std::make_shared<std::set<StringRef>>();
|
||||||
{
|
{
|
||||||
for (auto &Sym : (*Obj)->symbols()) {
|
for (auto &Sym : (*Obj)->symbols()) {
|
||||||
|
|
||||||
|
// Skip file symbols.
|
||||||
|
if (auto SymType = Sym.getType()) {
|
||||||
|
if (*SymType == object::SymbolRef::ST_File)
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
ES.reportError(SymType.takeError());
|
||||||
|
R.failMaterialization();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't include symbols that aren't global.
|
||||||
if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global)) {
|
if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global)) {
|
||||||
if (auto SymName = Sym.getName())
|
if (auto SymName = Sym.getName())
|
||||||
InternalSymbols->insert(*SymName);
|
InternalSymbols->insert(*SymName);
|
||||||
|
|
Loading…
Reference in New Issue