diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 32fb1803..99e473de 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -5507,6 +5507,14 @@ void PackLinuxElf32::pack4(OutputFile *fo, Filter &ft) set_te32(&phdro->p_flags, Elf32_Phdr::PF_X | get_te32(&phdro->p_flags)); } } + if (!sec_arm_attr && !saved_opt_android_shlib) { + // Make it abunantly clear that there are no Elf32_Shdr in this shlib + Elf32_Ehdr *ehdro = (Elf32_Ehdr *)lowmem.getVoidPtr(); + ehdro->e_shoff = 0; + ehdro->e_shentsize = 0; + ehdro->e_shnum = 0; + ehdro->e_shstrndx = 0; + } fo->rewrite(&lowmem[0], sizeof(ehdri) + e_phnum * sizeof(*phdri)); fo->seek(linfo_off, SEEK_SET); fo->rewrite(&linfo, sizeof(linfo)); // new info: l_checksum, l_size @@ -5581,6 +5589,13 @@ void PackLinuxElf64::pack4(OutputFile *fo, Filter &ft) set_te64(&phdro->p_flags, Elf64_Phdr::PF_X | get_te64(&phdro->p_flags)); } } + // Make it abundantly clear that there are no Elf64_Shdr in a compressed shlib + Elf64_Ehdr *ehdro = (Elf64_Ehdr *)lowmem.getVoidPtr(); + ehdro->e_shoff = 0; + ehdro->e_shentsize = 0; + ehdro->e_shnum = 0; + ehdro->e_shstrndx = 0; + fo->rewrite(&lowmem[0], sizeof(ehdri) + e_phnum * sizeof(*phdri)); fo->seek(linfo_off, SEEK_SET); fo->rewrite(&linfo, sizeof(linfo)); // new info: l_checksum, l_size