[PATCH] D89241: [RTDYLD] be more defensive about relocations with empty symbol names
Valentin Churavy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 07:58:27 PDT 2020
vchuravy updated this revision to Diff 297590.
vchuravy added a comment.
clang-format
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89241/new/
https://reviews.llvm.org/D89241
Files:
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
Index: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
===================================================================
--- llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -308,6 +308,7 @@
<< " SID: " << SectionID
<< " Offset: " << format("%p", (uintptr_t)Addr)
<< " flags: " << *FlagsOrErr << "\n");
+ assert(!Name.empty()); // Should not enter an empty symbol
GlobalSymbolTable[Name] = SymbolTableEntry(SectionID, Addr, *JITSymFlags);
} else if (SymType == object::SymbolRef::ST_Function ||
SymType == object::SymbolRef::ST_Data ||
@@ -340,6 +341,7 @@
<< " SID: " << SectionID
<< " Offset: " << format("%p", (uintptr_t)SectOffset)
<< " flags: " << *FlagsOrErr << "\n");
+ assert(!Name.empty()); // Should not enter an empty symbol
GlobalSymbolTable[Name] =
SymbolTableEntry(SectionID, SectOffset, *JITSymFlags);
}
@@ -769,6 +771,7 @@
LLVM_DEBUG(dbgs() << "Allocating common symbol " << Name << " address "
<< format("%p", Addr) << "\n");
+ assert(!Name.empty()); // Should not enter an empty symbol
GlobalSymbolTable[Name] =
SymbolTableEntry(SectionID, Offset, std::move(*JITSymFlags));
Offset += Size;
@@ -930,6 +933,8 @@
if (Loc == GlobalSymbolTable.end()) {
ExternalSymbolRelocations[SymbolName].push_back(RE);
} else {
+ assert(!SymbolName.empty() &&
+ "Empty symbol should not be in GlobalSymbolTable");
// Copy the RE since we want to modify its addend.
RelocationEntry RECopy = RE;
const auto &SymInfo = Loc->second;
@@ -1107,6 +1112,8 @@
// New entries may have been added to the relocation list.
i = ExternalSymbolRelocations.find(Name);
} else {
+ assert(!Name.empty() &&
+ "Empty symbol should not be in GlobalSymbolTable");
// We found the symbol in our global table. It was probably in a
// Module that we loaded previously.
const auto &SymInfo = Loc->second;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89241.297590.patch
Type: text/x-patch
Size: 2224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201012/c550c365/attachment.bin>
More information about the llvm-commits
mailing list