[llvm] 31e0331 - [ORC] Skip ST_File symbols in MaterializationUnit interfaces / resolution.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 16:16:00 PST 2020
Author: Lang Hames
Date: 2020-03-03T16:15:44-08:00
New Revision: 31e03317633909c50ead53edf8a19b60698075cc
URL: https://github.com/llvm/llvm-project/commit/31e03317633909c50ead53edf8a19b60698075cc
DIFF: https://github.com/llvm/llvm-project/commit/31e03317633909c50ead53edf8a19b60698075cc.diff
LOG: [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.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/Mangling.cpp
llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/Mangling.cpp b/llvm/lib/ExecutionEngine/Orc/Mangling.cpp
index 0f73eff0be31..b21a0d7f216a 100644
--- a/llvm/lib/ExecutionEngine/Orc/Mangling.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Mangling.cpp
@@ -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();
diff --git a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
index 895edf8bb187..f51bd9d3b1c2 100644
--- a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
@@ -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);
More information about the llvm-commits
mailing list