[PATCH] D14084: [ELF2] Move sorting from symbol table to the GNU hash section.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 26 10:46:12 PDT 2015
ruiu added inline comments.
================
Comment at: ELF/OutputSections.cpp:350
@@ -351,2 +349,3 @@
template <class ELFT> void GnuHashTableSection<ELFT>::writeTo(uint8_t *Buf) {
+ assert(NumHashed == HashedSymbols.size());
writeHeader(Buf);
----------------
Is NumHashed always the same as HashedSymbols.size()? If so, remove the variable and use HashedSymbols.size() instead.
================
Comment at: ELF/OutputSections.cpp:414-420
@@ +413,9 @@
+
+ SortBuf.reserve(Symbols.size());
+ for (SymbolBody *B : Symbols) {
+ if (includeInGnuHashTable(*B))
+ SortBuf.emplace_back(B, hashGnu(B->getName()));
+ else
+ SortBuf.emplace_back(B, None);
+ }
+
----------------
You can use std::partition to separate non-hashed symbols from hashed symbols first, and then sort the latter half.
================
Comment at: ELF/OutputSections.h:313-314
@@ +312,4 @@
+ struct HashedSymbolData {
+ HashedSymbolData(SymbolBody *Body, uint32_t Hash)
+ : Body(Body), Hash(Hash) {}
+ SymbolBody *Body;
----------------
You don't need this constructor. Instead of
HashedSymbolData(X, Y)
you can always do
HashedSymbolData{X, Y}
http://reviews.llvm.org/D14084
More information about the llvm-commits
mailing list