[ELF] Allow invalid sh_size%sh_entsize!=0 for non-SHF_MERGE sections
authorFangrui Song <maskray@google.com>
Fri, 3 Apr 2020 05:10:43 +0000 (22:10 -0700)
committerFangrui Song <maskray@google.com>
Fri, 3 Apr 2020 15:48:30 +0000 (08:48 -0700)
commit56decd982dc03a74d1796d9d4dbd7d9e0cea98dc
treee259d7691135878c684b23e9de3dfc855973d14e
parent80d4df5be66149fc02620961b094d1a4301e82e6
[ELF] Allow invalid sh_size%sh_entsize!=0 for non-SHF_MERGE sections

Fixes https://bugs.llvm.org/show_bug.cgi?id=45370
Fixes https://github.com/Clozure/ccl/issues/273

.stab holds a table of 12-byte entries. GNU as before 2.35 incorrectly
sets sh_entsize(.stab) to 20 on 64-bit architectures:
https://sourceware.org/bugzilla/show_bug.cgi?id=25768

We should not emit the confusing error:
"SHF_MERGE section size (...) must be a multiple of sh_entsize (20)

Reviewed By: grimar, psmith

Differential Revision: https://reviews.llvm.org/D77368
lld/ELF/InputFiles.cpp
lld/test/ELF/invalid/entsize.yaml [new file with mode: 0644]