Skip to content

Commit 2406bb4

Browse files
committed
[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.
1 parent 21fb474 commit 2406bb4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,18 @@ void RTDyldObjectLinkingLayer::emit(MaterializationResponsibility R,
115115
auto InternalSymbols = std::make_shared<std::set<StringRef>>();
116116
{
117117
for (auto &Sym : (*Obj)->symbols()) {
118+
119+
// Skip file symbols.
120+
if (auto SymType = Sym.getType()) {
121+
if (*SymType == object::SymbolRef::ST_File)
122+
continue;
123+
} else {
124+
ES.reportError(SymType.takeError());
125+
R.failMaterialization();
126+
return;
127+
}
128+
129+
// Don't include symbols that aren't global.
118130
if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global)) {
119131
if (auto SymName = Sym.getName())
120132
InternalSymbols->insert(*SymName);

0 commit comments

Comments
 (0)