Skip to content

Commit

Permalink
[ELF] Avoid repeated hash lookups (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Jan 12, 2025
1 parent 4f6fabd commit 276863d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lld/ELF/Arch/ARM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,8 +1320,9 @@ void elf::processArmCmseSymbols(Ctx &ctx) {
MutableArrayRef<Symbol *> syms = file->getMutableSymbols();
for (size_t i = 0, e = syms.size(); i != e; ++i) {
StringRef symName = syms[i]->getName();
if (ctx.symtab->cmseSymMap.count(symName))
syms[i] = ctx.symtab->cmseSymMap[symName].acleSeSym;
auto it = ctx.symtab->cmseSymMap.find(symName);
if (it != ctx.symtab->cmseSymMap.end())
syms[i] = it->second.acleSeSym;
}
});
}
Expand Down Expand Up @@ -1370,8 +1371,9 @@ void ArmCmseSGSection::addSGVeneer(Symbol *acleSeSym, Symbol *sym) {
// Only secure symbols with values equal to that of it's non-secure
// counterpart needs to be in the .gnu.sgstubs section.
std::unique_ptr<ArmCmseSGVeneer> ss;
if (ctx.symtab->cmseImportLib.count(sym->getName())) {
Defined *impSym = ctx.symtab->cmseImportLib[sym->getName()];
auto it = ctx.symtab->cmseImportLib.find(sym->getName());
if (it != ctx.symtab->cmseImportLib.end()) {
Defined *impSym = it->second;
ss = std::make_unique<ArmCmseSGVeneer>(sym, acleSeSym, impSym->value);
} else {
ss = std::make_unique<ArmCmseSGVeneer>(sym, acleSeSym);
Expand Down

0 comments on commit 276863d

Please sign in to comment.