[lld] r314603 - Fix 32-bit buildbots.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 30 14:28:50 PDT 2017


Author: ruiu
Date: Sat Sep 30 14:28:49 2017
New Revision: 314603

URL: http://llvm.org/viewvc/llvm-project?rev=314603&view=rev
Log:
Fix 32-bit buildbots.

The result of hash_value(StringRef) depends on sizeof(size_t).
That causes lld to create different mergeable table contents on
32-bit machines.

This patch is to use xxHash64 so that we get the same hash values
on 32-bit machines.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/test/ELF/comment-gc.s
    lld/trunk/test/ELF/compressed-debug-input.s
    lld/trunk/test/ELF/debug-gc.s

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=314603&r1=314602&r2=314603&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Sat Sep 30 14:28:49 2017
@@ -25,6 +25,7 @@
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Threading.h"
+#include "llvm/Support/xxhash.h"
 #include <mutex>
 
 using namespace llvm;
@@ -903,7 +904,7 @@ void MergeInputSection::splitStrings(Arr
       fatal(toString(this) + ": string is not null terminated");
     size_t Size = End + EntSize;
     Pieces.emplace_back(Off, !IsAlloc);
-    Hashes.push_back(hash_value(toStringRef(Data.slice(0, Size))));
+    Hashes.push_back(xxHash64(toStringRef(Data.slice(0, Size))));
     Data = Data.slice(Size);
     Off += Size;
   }
@@ -917,7 +918,7 @@ void MergeInputSection::splitNonStrings(
   assert((Size % EntSize) == 0);
   bool IsAlloc = this->Flags & SHF_ALLOC;
   for (unsigned I = 0, N = Size; I != N; I += EntSize) {
-    Hashes.push_back(hash_value(toStringRef(Data.slice(I, EntSize))));
+    Hashes.push_back(xxHash64(toStringRef(Data.slice(I, EntSize))));
     Pieces.emplace_back(I, !IsAlloc);
   }
 }

Modified: lld/trunk/test/ELF/comment-gc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/comment-gc.s?rev=314603&r1=314602&r2=314603&view=diff
==============================================================================
--- lld/trunk/test/ELF/comment-gc.s (original)
+++ lld/trunk/test/ELF/comment-gc.s Sat Sep 30 14:28:49 2017
@@ -5,7 +5,7 @@
 # RUN: llvm-objdump -s %t1 | FileCheck %s
 
 # CHECK:      Contents of section .comment:
-# CHECK-NEXT: foo.LLD 1.0..bar
+# CHECK-NEXT: foo..LLD 1.0.bar
 
 .ident "foo"
 

Modified: lld/trunk/test/ELF/compressed-debug-input.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/compressed-debug-input.s?rev=314603&r1=314602&r2=314603&view=diff
==============================================================================
--- lld/trunk/test/ELF/compressed-debug-input.s (original)
+++ lld/trunk/test/ELF/compressed-debug-input.s Sat Sep 30 14:28:49 2017
@@ -61,10 +61,10 @@
 # DATA-NEXT:   AddressAlignment: 1
 # DATA-NEXT:   EntrySize: 0
 # DATA-NEXT:   SectionData (
-# DATA-NEXT:     0000: 756E7369 676E6564 20696E74 00636861  |unsigned int.cha|
-# DATA-NEXT:     0010: 7200756E 7369676E 65642063 68617200  |r.unsigned char.|
-# DATA-NEXT:     0020: 6C6F6E67 20756E73 69676E65 6420696E  |long unsigned in|
-# DATA-NEXT:     0030: 74007368 6F727420 756E7369 676E6564  |t.short unsigned|
+# DATA-NEXT:     0000: 6C6F6E67 20756E73 69676E65 6420696E  |long unsigned in|
+# DATA-NEXT:     0010: 7400756E 7369676E 65642063 68617200  |t.unsigned char.|
+# DATA-NEXT:     0020: 756E7369 676E6564 20696E74 00636861  |unsigned int.cha|
+# DATA-NEXT:     0030: 72007368 6F727420 756E7369 676E6564  |r.short unsigned|
 # DATA-NEXT:     0040: 20696E74 00                          | int.|
 # DATA-NEXT:   )
 # DATA-NEXT: }

Modified: lld/trunk/test/ELF/debug-gc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/debug-gc.s?rev=314603&r1=314602&r2=314603&view=diff
==============================================================================
--- lld/trunk/test/ELF/debug-gc.s (original)
+++ lld/trunk/test/ELF/debug-gc.s Sat Sep 30 14:28:49 2017
@@ -4,11 +4,11 @@
 # RUN: llvm-objdump -s %t1 | FileCheck %s
 
 # CHECK:      Contents of section .debug_str:
-# CHECK-NEXT:  0000 41414100 42424200 43434300           AAA.BBB.CCC.
+# CHECK-NEXT:  0000 41414100 43434300 42424200           AAA.CCC.BBB.
 # CHECK:      Contents of section .foo:
 # CHECK-NEXT:  0000 2a000000
 # CHECK:      Contents of section .debug_info:
-# CHECK-NEXT:  0000 00000000 04000000
+# CHECK-NEXT:  0000 00000000 08000000
 
 .globl _start
 _start:




More information about the llvm-commits mailing list