[lld] r298934 - Do not set entsize for .gnu.hash.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 11:11:53 PDT 2017


Author: ruiu
Date: Tue Mar 28 13:11:52 2017
New Revision: 298934

URL: http://llvm.org/viewvc/llvm-project?rev=298934&view=rev
Log:
Do not set entsize for .gnu.hash.

.gnu.hash happen to contain only 32-bit integers for 32-bit arch,
but the section contents are not uniform array members, so setting
entsize doesn't make much sense. This behavior seems to have been
blindly copied from GNU linkers.

Modified:
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/test/ELF/gnu-hash-table.s

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=298934&r1=298933&r2=298934&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Mar 28 13:11:52 2017
@@ -1439,9 +1439,7 @@ template <class ELFT> void SymbolTableSe
 // safe bet is to specify -hash-style=both for backward compatibilty.
 template <class ELFT>
 GnuHashTableSection<ELFT>::GnuHashTableSection()
-    : SyntheticSection(SHF_ALLOC, SHT_GNU_HASH, sizeof(uintX_t), ".gnu.hash") {
-  this->Entsize = ELFT::Is64Bits ? 0 : 4;
-}
+    : SyntheticSection(SHF_ALLOC, SHT_GNU_HASH, sizeof(uintX_t), ".gnu.hash") {}
 
 template <class ELFT> void GnuHashTableSection<ELFT>::finalizeContents() {
   this->OutSec->Link = In<ELFT>::DynSymTab->OutSec->SectionIndex;

Modified: lld/trunk/test/ELF/gnu-hash-table.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-hash-table.s?rev=298934&r1=298933&r2=298934&view=diff
==============================================================================
--- lld/trunk/test/ELF/gnu-hash-table.s (original)
+++ lld/trunk/test/ELF/gnu-hash-table.s Tue Mar 28 13:11:52 2017
@@ -56,7 +56,7 @@
 # I386-NEXT:     Link:
 # I386-NEXT:     Info: 0
 # I386-NEXT:     AddressAlignment: 4
-# I386-NEXT:     EntrySize: 4
+# I386-NEXT:     EntrySize: 0
 # I386:      ]
 # I386:      DynamicSymbols [
 # I386:        Symbol {




More information about the llvm-commits mailing list