user_init_va on AARCH64

https://github.com/upx/upx/issues/318  (work-in-progress)
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
This commit is contained in:
John Reiser 2019-12-04 14:26:46 -08:00
parent 5d295c24f0
commit b8f52d14f4
2 changed files with 7 additions and 1 deletions

View File

@ -242,6 +242,8 @@
R_PPC_JMP_SLOT = 21,
R_PPC64_JMP_SLOT = R_PPC_JMP_SLOT,
R_X86_64_JUMP_SLOT = 7
, R_AARCH64_ABS64 = 257
};
#endif //}

View File

@ -2446,7 +2446,7 @@ PackLinuxElf64::canPack()
xct_va = ~0ull;
if (e_shnum) {
for (int j= e_shnum; --j>=0; ++shdr) {
unsigned const sh_type = get_te64(&shdr->sh_type);
unsigned const sh_type = get_te32(&shdr->sh_type);
if (Elf64_Shdr::SHF_EXECINSTR & get_te64(&shdr->sh_flags)) {
xct_va = umin(xct_va, get_te64(&shdr->sh_addr));
}
@ -2482,6 +2482,10 @@ PackLinuxElf64::canPack()
&& R_AARCH64_RELATIVE == r_type) {
user_init_va = get_te64(&rp->r_addend);
}
else if (Elf64_Ehdr::EM_AARCH64 == e_machine
&& R_AARCH64_ABS64 == r_type) {
user_init_va = get_te64(&file_image[user_init_off]);
}
else {
char msg[50]; snprintf(msg, sizeof(msg),
"bad relocation %#x DT_INIT_ARRAY[0]",