[PATCH] D13815: [ELF2] Add support for Gnu Hash section

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 06:07:29 PDT 2015


>> I like the idea to sort entries of a symbol table within the symbol table class, but in case of the Gnu hash section, it imposes not only some requirements to the order of entries, but also the oreder itself, as it is calculated using hash values and NBuckets parameter. I can't find a better solution than sorting the symbols which belongs to Gnu Hash table within the GnuHashTableSection class.
> One more thing. If we implement one method to sort the entire dynamic symbol table and set indexes of the entries, we have to decide, when it should be called. The right place to call thist sort function might be the finalize() method of the symbol table class. But the sort function will require some information, which can only be provided by the Gnu hash table class, and the right place to calculate it is the finalize() method of this class. I don't think it's a good idea to rely on the order of calling of finalize() methods.

What about:

* In the current loop:
   Out<ELFT>::DynSymTab->addSymbol(...)
* Sort the DynSymTab if needed:
  if (Out<ELFT>::GnuHashTab)
     GnuHashTable<ELFT>::sortDynamicSymbols()

* Walk the DynSymTab, calling setDynamicSymbolTableIndex and adding
the symbol to one or both hash tables.


More information about the llvm-commits mailing list