Propagate .e_ident[EI_ABIVERSION]

Linux on bare metal (and explicit qemu) seems not to care,
but qemu-user-binfmt gives ENOEXEC (Exec format error)
        https://github.com/upx/upx/issues/876
This commit is contained in:
John Reiser
2025-02-07 19:24:46 -08:00
committed by Markus F.X.J. Oberhumer
parent bddc05e787
commit 8c9e04daaf
2 changed files with 75 additions and 71 deletions
+5 -1
View File
@@ -3771,7 +3771,11 @@ PackLinuxElf32::generateElfHdr(
h3->ehdr.e_ident[EI_DATA] = ei_data;
h3->ehdr.e_ident[EI_VERSION] = EV_CURRENT;
h3->ehdr.e_ident[EI_OSABI] = ei_osabi;
h3->ehdr.e_ident[EI_ABIVERSION] = 1; // ei_abiversion;
h3->ehdr.e_ident[EI_ABIVERSION] = ehdri.e_ident[EI_ABIVERSION]; // ei_abiversion ?
// Perhaps NT_GNU_ABI_TAG from Shdr .note.ABI-tag or PT_NOTE ?
// But that is much too recent (and un-standardized) for other software.
set_te32(&h3->ehdr.e_phoff, sizeof(Elf32_Ehdr));
set_te16(&h3->ehdr.e_ehsize,sizeof(Elf32_Ehdr));
set_te16(&h3->ehdr.e_phentsize, sizeof(Elf32_Phdr));