[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:52:16 PST 2018


smeenai updated this revision to Diff 129395.
smeenai added a comment.

Change comment to refer to existing one


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41928

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


Index: test/ELF/sysv-hash-no-rosegment.s
===================================================================
--- /dev/null
+++ 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: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ 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.129395.patch
Type: text/x-patch
Size: 979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180111/8a0a9012/attachment.bin>


More information about the llvm-commits mailing list