linux-user: Do not subtract offset from end address
authorTom Musta <tommusta@gmail.com>
Thu, 6 Nov 2014 19:43:13 +0000 (13:43 -0600)
committerRiku Voipio <riku.voipio@linaro.org>
Tue, 11 Nov 2014 06:12:45 +0000 (08:12 +0200)
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>
linux-user/elfload.c

index 84123baa58f27cd4a955aa4c5ea1c97e3b562181..e2596a4201d987d566e50e1fcffc5deb2b4f6881 100644 (file)
@@ -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;
             }