[PATCH] D65590: Make name resolution in ORC skip extra symbols
Sasha Krassovsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 10:26:51 PDT 2019
save-buffer created this revision.
save-buffer added reviewers: compnerd, xiaobai, lhames.
save-buffer added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya.
Currently, assertion fails if an object file's symbol table has more symbols than is requested by the materialization unit. This is incorrect because some formats add extra symbols. For example, when COFF object file is generated, some symbols get inserted (for example, if a float is added, it adds a symbol __real@<HEX OF FLOAT>. This caused issues down the line because more symbols were being resolved than asked for in the query. This change makes symbol resolution skip these extra symbols.
https://reviews.llvm.org/D65590
Files:
llvm/lib/ExecutionEngine/Orc/Core.cpp
Index: llvm/lib/ExecutionEngine/Orc/Core.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -374,8 +374,12 @@
#ifndef NDEBUG
for (auto &KV : Symbols) {
auto I = SymbolFlags.find(KV.first);
- assert(I != SymbolFlags.end() &&
- "Resolving symbol outside this responsibility set");
+ // Certain file formats like COFF add symbols to the symbol table
+ // that don't exist in the IR. Therefore, we just ignore it if
+ // there are extra symbols.
+ if (I == SymbolFlags.end())
+ continue;
+
// Mask out Exported for compatibility with COFF
constexpr auto Mask = ~JITSymbolFlags::Exported;
if (I->second.isWeak())
@@ -866,7 +870,12 @@
auto I = Symbols.find(Name);
- assert(I != Symbols.end() && "Symbol not found");
+ // Certain file formats like COFF add symbols to the symbol table
+ // that don't exist in the IR. Therefore, we just ignore it if
+ // there are extra symbols.
+ if (I == Symbols.end())
+ continue;
+
assert(!I->second.hasMaterializerAttached() &&
"Resolving symbol with materializer attached?");
assert(I->second.getState() == SymbolState::Materializing &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65590.212847.patch
Type: text/x-patch
Size: 1303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190801/564dfdea/attachment.bin>
More information about the llvm-commits
mailing list