[llvm] [llvm-symbolizer] nfc, use map instead of vector (PR #69552)
Chen Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 17:44:38 PDT 2023
================
@@ -134,7 +120,10 @@ Error SymbolizableObjectFile::addCoffExportSymbols(
uint32_t NextOffset = I != E ? I->Offset : Export.Offset + 1;
uint64_t SymbolStart = ImageBase + Export.Offset;
uint64_t SymbolSize = NextOffset - Export.Offset;
- Symbols.push_back({SymbolStart, SymbolSize, Export.Name, 0});
+ // If the SymbolStart exists, use the one with the large Size.
+ // This helps us avoid symbols with no size information (Size = 0).
+ if (!Symbols.count(SymbolStart) || SymbolSize >= Symbols[SymbolStart].Size)
+ Symbols[SymbolStart] = {SymbolSize, Export.Name, 0};
----------------
chenzheng1030 wrote:
If two symbols have same address, it will follow legacy logic, i.e. use the one with the large size. So for your case, `aaa` will be kept in the `Symbols` while `bbb` will be dropped.
https://github.com/llvm/llvm-project/pull/69552
More information about the llvm-commits
mailing list