[ELF] GnuHashTableSection: replace stable_sort with 2-key sort. NFC

strTabOffset stabilizes llvm::sort. My x86-64 executable is 5+KiB smaller.
This commit is contained in:
Fangrui Song 2022-01-17 00:34:42 -08:00
parent 4796b4ae7b
commit f855074ed1
1 changed files with 3 additions and 2 deletions

View File

@ -2478,8 +2478,9 @@ void GnuHashTableSection::addSymbols(SmallVectorImpl<SymbolTableEntry> &v) {
symbols.push_back({b, ent.strTabOffset, hash, bucketIdx}); symbols.push_back({b, ent.strTabOffset, hash, bucketIdx});
} }
llvm::stable_sort(symbols, [](const Entry &l, const Entry &r) { llvm::sort(symbols, [](const Entry &l, const Entry &r) {
return l.bucketIdx < r.bucketIdx; return std::tie(l.bucketIdx, l.strTabOffset) <
std::tie(r.bucketIdx, r.strTabOffset);
}); });
v.erase(mid, v.end()); v.erase(mid, v.end());