Index: lld/trunk/ELF/OutputSections.cpp =================================================================== --- lld/trunk/ELF/OutputSections.cpp +++ lld/trunk/ELF/OutputSections.cpp @@ -1220,6 +1220,7 @@ ArrayRef D = S->getSectionData(); StringRef Data((const char *)D.data(), D.size()); uintX_t EntSize = S->getSectionHdr()->sh_entsize; + this->Header.sh_entsize = EntSize; // If this is of type string, the contents are null-terminated strings. if (this->Header.sh_flags & SHF_STRINGS) { Index: lld/trunk/test/ELF/merge-string.s =================================================================== --- lld/trunk/test/ELF/merge-string.s +++ lld/trunk/test/ELF/merge-string.s @@ -32,7 +32,7 @@ // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 1 -// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: EntrySize: 1 // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 61626300 |abc.| // CHECK-NEXT: ) @@ -50,7 +50,7 @@ // NOTAIL-NEXT: Link: 0 // NOTAIL-NEXT: Info: 0 // NOTAIL-NEXT: AddressAlignment: 1 -// NOTAIL-NEXT: EntrySize: 0 +// NOTAIL-NEXT: EntrySize: 1 // NOTAIL-NEXT: SectionData ( // NOTAIL-NEXT: 0000: 61626300 626300 |abc.bc.| // NOTAIL-NEXT: ) @@ -68,7 +68,7 @@ // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 2 -// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: EntrySize: 2 // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 |....| // CHECK-NEXT: ) Index: lld/trunk/test/ELF/merge.s =================================================================== --- lld/trunk/test/ELF/merge.s +++ lld/trunk/test/ELF/merge.s @@ -29,7 +29,7 @@ // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 4 -// CHECK-NEXT: EntrySize: 0 +// CHECK-NEXT: EntrySize: 4 // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 10000000 42000000 // CHECK-NEXT: )