base: Add warning when failing to insert a whole symbol table

Current 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 very common.

This change adds a warning and recommends a fix instead of silently
dropping the table. This is useful for debugging when there are two
or more workloads, e.g. bootloader + kernel, are added separately.

Change-Id: I9e4cf06037cd70926fb5cee3c4dab464daf0912e
Signed-off-by: Hoa Nguyen <hn@hnpl.org>
This commit is contained in:
Hoa Nguyen
2023-09-25 16:23:17 -07:00
parent 010ac43369
commit 91e55d9c60

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);