[PATCH] D41928: [ELF] Fix SysV hash tables with --no-rosegment

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 22:58:31 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL322259: [ELF] Fix SysV hash tables with --no-rosegment (authored by smeenai, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D41928

Files:
  lld/trunk/ELF/SyntheticSections.cpp
  lld/trunk/test/ELF/sysv-hash-no-rosegment.s


Index: lld/trunk/test/ELF/sysv-hash-no-rosegment.s
===================================================================
--- lld/trunk/test/ELF/sysv-hash-no-rosegment.s
+++ lld/trunk/test/ELF/sysv-hash-no-rosegment.s
@@ -0,0 +1,13 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld -shared --no-rosegment -o %t %t.o
+# RUN: llvm-readobj -hash-table %t | FileCheck %s
+
+# CHECK:      HashTable {
+# CHECK-NEXT:   Num Buckets: 2
+# CHECK-NEXT:   Num Chains: 2
+# CHECK-NEXT:   Buckets: [1, 0]
+# CHECK-NEXT:   Chains: [0, 0]
+# CHECK-NEXT: }
+
+callq undef at PLT
Index: lld/trunk/ELF/SyntheticSections.cpp
===================================================================
--- lld/trunk/ELF/SyntheticSections.cpp
+++ lld/trunk/ELF/SyntheticSections.cpp
@@ -1836,6 +1836,9 @@
 }
 
 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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41928.129396.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180111/b235cdeb/attachment.bin>


More information about the llvm-commits mailing list