linux-user: Use abi_ulong for TARGET_ELF_PAGESTART
authorYongbok Kim <yongbok.kim@imgtec.com>
Mon, 20 Apr 2015 15:15:20 +0000 (16:15 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Mon, 15 Jun 2015 08:36:58 +0000 (11:36 +0300)
TARGET_ELF_PAGESTART is required to use abi_ulong to correctly handle
addresses for different target bits width.
This patch fixes a problem when running a 64-bit user mode application
on 32-bit host machines.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/elfload.c

index b71e86697362b893b822314840c87ec8da8d2832..17883686f0704b85e5dbd7e80ca9f433f390f108 100644 (file)
@@ -1256,7 +1256,8 @@ struct exec
 
 /* Necessary parameters */
 #define TARGET_ELF_EXEC_PAGESIZE TARGET_PAGE_SIZE
-#define TARGET_ELF_PAGESTART(_v) ((_v) & ~(unsigned long)(TARGET_ELF_EXEC_PAGESIZE-1))
+#define TARGET_ELF_PAGESTART(_v) ((_v) & \
+                                 ~(abi_ulong)(TARGET_ELF_EXEC_PAGESIZE-1))
 #define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1))
 
 #define DLINFO_ITEMS 14