[lld] r322642 - Merging r322259:

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 04:58:35 PST 2018


Author: hans
Date: Wed Jan 17 04:58:35 2018
New Revision: 322642

URL: http://llvm.org/viewvc/llvm-project?rev=322642&view=rev
Log:
Merging r322259:
------------------------------------------------------------------------
r322259 | smeenai | 2018-01-10 22:57:01 -0800 (Wed, 10 Jan 2018) | 11 lines

[ELF] Fix SysV hash tables with --no-rosegment

When setting up the chain, we copy over the bucket's previous symbol
index, assuming that this index will be 0 (STN_UNDEF) for an unused
bucket (marking the end of the chain). When linking with --no-rosegment,
however, unused buckets will in fact contain the padding value, and so
the hash table will end up containing invalid chains. Zero out the hash
table section explicitly to avoid this, similar to what's already done
for GNU hash sections.

Differential Revision: https://reviews.llvm.org/D41928
------------------------------------------------------------------------

Added:
    lld/branches/release_60/test/ELF/sysv-hash-no-rosegment.s
      - copied unchanged from r322259, lld/trunk/test/ELF/sysv-hash-no-rosegment.s
Modified:
    lld/branches/release_60/   (props changed)
    lld/branches/release_60/ELF/SyntheticSections.cpp

Propchange: lld/branches/release_60/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 17 04:58:35 2018
@@ -1 +1 @@
-/lld/trunk:321983,321986
+/lld/trunk:321983,321986,322259

Modified: lld/branches/release_60/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_60/ELF/SyntheticSections.cpp?rev=322642&r1=322641&r2=322642&view=diff
==============================================================================
--- lld/branches/release_60/ELF/SyntheticSections.cpp (original)
+++ lld/branches/release_60/ELF/SyntheticSections.cpp Wed Jan 17 04:58:35 2018
@@ -1823,6 +1823,9 @@ void HashTableSection::finalizeContents(
 }
 
 void HashTableSection::writeTo(uint8_t *Buf) {
+  // See comment in GnuHashTableSection::writeTo.
+  memset(Buf, 0, Size);
+
   unsigned NumSymbols = InX::DynSymTab->getNumSymbols();
 
   uint32_t *P = reinterpret_cast<uint32_t *>(Buf);




More information about the llvm-commits mailing list