base: Add a warning when failing to insert a whole symbol table (#361)

Currently we drop the insertion of a whole symbol table if the name of
one symbol already exists in the base table. Having similar symbols
across different binaries is common.

This change adds a warning and recommends a fix instead of silently
dropping the table.
This commit is contained in:
Bobby R. Bruce
2023-09-27 17:26:03 -07:00
committed by GitHub

View File

@@ -79,8 +79,11 @@ SymbolTable::insert(const SymbolTable &other)
nameMap.begin(), nameMap.end(),
std::inserter(intersection, intersection.begin()),
nameMap.value_comp());
if (!intersection.empty())
if (!intersection.empty()) {
warn("Cannot insert a new symbol table due to name collisions. "
"Adding prefix to each symbol's name can resolve this issue.");
return false;
}
for (const Symbol &symbol: other)
insert(symbol);