diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 5bccd2e2..94e928a4 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -20,6 +20,8 @@ #define ELF_OSABI ELFOSABI_SYSV +extern abi_ulong afl_entry_point, afl_start_code, afl_end_code; + /* from personality.h */ /* @@ -2301,6 +2303,8 @@ static void load_elf_image(const char *image_name, int image_fd, info->brk = 0; info->elf_flags = ehdr->e_flags; + if (!afl_entry_point) afl_entry_point = info->entry; + for (i = 0; i < ehdr->e_phnum; i++) { struct elf_phdr *eppnt = phdr + i; if (eppnt->p_type == PT_LOAD) { @@ -2335,9 +2339,11 @@ static void load_elf_image(const char *image_name, int image_fd, if (elf_prot & PROT_EXEC) { if (vaddr < info->start_code) { info->start_code = vaddr; + if (!afl_start_code) afl_start_code = vaddr; } if (vaddr_ef > info->end_code) { info->end_code = vaddr_ef; + if (!afl_end_code) afl_end_code = vaddr_ef; } } if (elf_prot & PROT_WRITE) {