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.
llvm-svn: 314603
#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;
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;
}
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);
}
}
# 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"
# 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: }
# 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: