1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[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:
Lang Hames 2020-03-03 16:02:46 -08:00
parent 53ede36a1c
commit af3fbf0d88
2 changed files with 19 additions and 0 deletions

View File

@ -99,6 +99,13 @@ getObjectSymbolInfo(ExecutionSession &ES, MemoryBufferRef ObjBuffer) {
if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global))
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();
if (!Name)
return Name.takeError();

View File

@ -116,6 +116,18 @@ void RTDyldObjectLinkingLayer::emit(MaterializationResponsibility R,
auto InternalSymbols = std::make_shared<std::set<StringRef>>();
{
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 (auto SymName = Sym.getName())
InternalSymbols->insert(*SymName);