From: Tom Musta <tommu...@gmail.com> When computing the upper address of a program segment, do not subtract the offset from the virtual address; instead compute the sum of the virtual address and the memory size.
Signed-off-by: Tom Musta <tommu...@gmail.com> Signed-off-by: Riku Voipio <riku.voi...@linaro.org> --- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 84123ba..e2596a4 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1824,7 +1824,7 @@ static void load_elf_image(const char *image_name, int image_fd, if (a < loaddr) { loaddr = a; } - a += phdr[i].p_memsz; + a = phdr[i].p_vaddr + phdr[i].p_memsz; if (a > hiaddr) { hiaddr = a; } -- 2.1.1