summary refs log tree commit diff stats
path: root/linux-user/elfload.c
diff options
context:
space:
mode:
authorTom Musta <tommusta@gmail.com>2014-11-06 13:43:13 -0600
committerRiku Voipio <riku.voipio@linaro.org>2014-11-11 08:12:45 +0200
commitccf661f827faf700b03a30076b5f944e8f787280 (patch)
tree98baaa004b686a0d004c495d74bdb175966def0e /linux-user/elfload.c
parent558c2c8ddfb165a36eb95dc93125c04829d68aa7 (diff)
downloadfocaccia-qemu-ccf661f827faf700b03a30076b5f944e8f787280.tar.gz
focaccia-qemu-ccf661f827faf700b03a30076b5f944e8f787280.zip
linux-user: Do not subtract offset from end address
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 <tommusta@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r--linux-user/elfload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 84123baa58..e2596a4201 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;
             }