[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:38:56 PDT 2016


grimar added inline comments.

================
Comment at: ELF/OutputSections.cpp:1223
@@ -1222,2 +1222,3 @@
   uintX_t EntSize = S->getSectionHdr()->sh_entsize;
+  this->Header.sh_entsize = EntSize;
 
----------------
I think there is no rule what EntSize to take. Gold uses the first size he saw here:

```
.section	.rodata.1,"aMS", at progbits,2
.asciz	"a"

.section        .rodata.1,"aMS", at progbits,1
.asciz	"b"
...
            
  EntSize == 2:
  [ 2] .rodata.1         PROGBITS         0000000000000000  00000040  0000000000000004  0000000000000002

```



```

.section	.rodata.1,"aMS", at progbits,1
.asciz	"a"

.section        .rodata.1,"aMS", at progbits,2
.asciz	"b"

...

  EntSize == 1:               
  [ 2] .rodata.1         PROGBITS         0000000000000000  00000040  0000000000000004  0000000000000001
```

So I think there is no need in any conditions and we can just assign here.


http://reviews.llvm.org/D18248





More information about the llvm-commits mailing list