[lld] r263780 - [ELF] - Set the sh_entsize for mergable sections
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 18 02:28:40 PDT 2016
Author: grimar
Date: Fri Mar 18 04:28:39 2016
New Revision: 263780
URL: http://llvm.org/viewvc/llvm-project?rev=263780&view=rev
Log:
[ELF] - Set the sh_entsize for mergable sections
Previously sh_entsize field was not set for MergeOutputSection.
Patch fixes that.
That should resolve the https://llvm.org/bugs/show_bug.cgi?id=26975
Differential revision: http://reviews.llvm.org/D18248
Modified:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/test/ELF/merge-string.s
lld/trunk/test/ELF/merge.s
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=263780&r1=263779&r2=263780&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Fri Mar 18 04:28:39 2016
@@ -1220,6 +1220,7 @@ void MergeOutputSection<ELFT>::addSectio
ArrayRef<uint8_t> 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) {
Modified: lld/trunk/test/ELF/merge-string.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-string.s?rev=263780&r1=263779&r2=263780&view=diff
==============================================================================
--- lld/trunk/test/ELF/merge-string.s (original)
+++ lld/trunk/test/ELF/merge-string.s Fri Mar 18 04:28:39 2016
@@ -32,7 +32,7 @@ zed:
// 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 @@ zed:
// 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 @@ zed:
// 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: )
Modified: lld/trunk/test/ELF/merge.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge.s?rev=263780&r1=263779&r2=263780&view=diff
==============================================================================
--- lld/trunk/test/ELF/merge.s (original)
+++ lld/trunk/test/ELF/merge.s Fri Mar 18 04:28:39 2016
@@ -29,7 +29,7 @@ zed:
// 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: )
More information about the llvm-commits
mailing list