[PATCH] D18248: [ELF] - Set the sh_entsize for mergable sections

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 10:31:27 PDT 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.

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 

http://reviews.llvm.org/D18248

Files:
  ELF/OutputSections.cpp
  test/ELF/merge-string.s
  test/ELF/merge.s

Index: test/ELF/merge.s
===================================================================
--- test/ELF/merge.s
+++ 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:    )
Index: test/ELF/merge-string.s
===================================================================
--- test/ELF/merge-string.s
+++ 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: ELF/OutputSections.cpp
===================================================================
--- ELF/OutputSections.cpp
+++ ELF/OutputSections.cpp
@@ -1220,6 +1220,7 @@
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18248.50954.patch
Type: text/x-patch
Size: 1888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160317/3a4ec3b6/attachment.bin>


More information about the llvm-commits mailing list