Depending on whether the ELF was 32 or 64 bit elf_compress would get
the original sh_addralign, as embedded in the Chdr, differenly. For
64bit ELF we would simply get the sh_addralign from the Shdr. For
32bit ELF we would take the (max) alignment of the underlying
Elf_Data, provided by __libelf_compress. Use the second method for
both since the Shdr might not have been setup yet, so what counts is
the Elf_Data alignment.
* libelf/elf_compress.c (elf_compress): Remove sh_addralign.
Set chdr.ch_addralign to orig_addralign in 64bit case.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Elf64_Xword sh_flags;
Elf64_Word sh_type;
- Elf64_Xword sh_addralign;
union shdr
{
Elf32_Shdr *s32;
sh_flags = shdr.s32->sh_flags;
sh_type = shdr.s32->sh_type;
- sh_addralign = shdr.s32->sh_addralign;
}
else
{
sh_flags = shdr.s64->sh_flags;
sh_type = shdr.s64->sh_type;
- sh_addralign = shdr.s64->sh_addralign;
}
if ((sh_flags & SHF_ALLOC) != 0)
chdr.ch_type = type;
chdr.ch_reserved = 0;
chdr.ch_size = orig_size;
- chdr.ch_addralign = sh_addralign;
+ chdr.ch_addralign = orig_addralign;
if (elfdata != MY_ELFDATA)
{
CONVERT (chdr.ch_type);