From 91e55d9c60bb0fe8a307d1bd013e94841fc96ffe Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Mon, 25 Sep 2023 16:23:17 -0700 Subject: [PATCH] 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 --- src/base/loader/symtab.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/base/loader/symtab.cc b/src/base/loader/symtab.cc index 941ea101c9..041476bf7d 100644 --- a/src/base/loader/symtab.cc +++ b/src/base/loader/symtab.cc @@ -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);