[PATCH] D23713: [ELF] - Fix for PR26968 - i386 lld produces incorrect fatal error "SHF_MERGE section size must be a multiple of sh_entsize"

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 08:27:43 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/InputFiles.cpp:188
@@ +187,3 @@
+
+  // In a FreeBSD/i386 world many objects have SHF_MERGE with sh_entsize == 0.
+  if (!EntSize && Config->EMachine == EM_386)
----------------
emaste wrote:
> This is no longer true; the objects with `sh_entsize == 0` were due to a bug with lld -r that has since been fixed. So we no longer encounter this issue on FreeBSD/i386. Thus, this issue comes down to a question of what should lld do if it encounters atypical / unusual input.
> 
> From http://www.sco.com/developers/gabi/1998-04-29/ch4.sheader.html, sh_entsize
> > contains 0 if the section does not hold a table of fixed-size entries.
> https://docs.oracle.com/cd/E19120-01/open.solaris/819-0690/ggdlu/index.html suggests that mergeable string sections may have `sh_entsize == 0`.
> 
> In my opinion restoring rL263664 is reasonable; objects with `SHF_MERGE` and `sh_entsize == 0` are not invalid, and the linker is free to just avoid the merge optimization in this case.
> 
It sounds like

 SHF_STRINGS sections: sh_entsize of 0 is valid and should be treated as if 1.
 non-SHF_STRINGS sections: sh_entsize of 0 is invalid (?) and should be treated as non-mergeable sections.


https://reviews.llvm.org/D23713





More information about the llvm-commits mailing list