[LLD][ELF] Drop the string null terminator from the hash in splitStrings
Differential Revision: https://reviews.llvm.org/D126484
This commit is contained in:
@@ -1376,15 +1376,15 @@ void MergeInputSection::splitStrings(StringRef s, size_t entSize) {
|
||||
if (entSize == 1) {
|
||||
// Optimize the common case.
|
||||
do {
|
||||
size_t size = strlen(p) + 1;
|
||||
size_t size = strlen(p);
|
||||
pieces.emplace_back(p - s.begin(), xxHash64(StringRef(p, size)), live);
|
||||
p += size;
|
||||
p += size + 1;
|
||||
} while (p != end);
|
||||
} else {
|
||||
do {
|
||||
size_t size = findNull(StringRef(p, end - p), entSize) + entSize;
|
||||
size_t size = findNull(StringRef(p, end - p), entSize);
|
||||
pieces.emplace_back(p - s.begin(), xxHash64(StringRef(p, size)), live);
|
||||
p += size;
|
||||
p += size + entSize;
|
||||
} while (p != end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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: .LLD 1.0.foo.bar
|
||||
|
||||
.ident "foo"
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ zed:
|
||||
// NOTAIL-NEXT: AddressAlignment: 1
|
||||
// NOTAIL-NEXT: EntrySize: 1
|
||||
// NOTAIL-NEXT: SectionData (
|
||||
// NOTAIL-NEXT: 0000: 62630061 626300 |bc.abc.|
|
||||
// NOTAIL-NEXT: 0000: 61626300 626300 |abc.bc.|
|
||||
// NOTAIL-NEXT: )
|
||||
|
||||
// NOMERGE: Name: .rodata1
|
||||
|
||||
Reference in New Issue
Block a user