aboutsummaryrefslogtreecommitdiff
path: root/linux-user/elfload.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-03-07 18:40:43 +0000
committerPeter Maydell <peter.maydell@linaro.org>2019-03-07 18:40:43 +0000
commitc4e0780ed1ffd056f205348d387a61b4136a45df (patch)
tree1b2f96807ab10e5b0d6210d2ad903223a70a20db /linux-user/elfload.c
parent6cb4f6db4f4367faa33da85b15f75bbbd2bed2a6 (diff)
parent61b463fbf6cbf21fcd9abb5af765a19b88dbc1ba (diff)
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.0-pull-request' into staging
- Update netlink types to linux v5.0 - fix accept4/getpeername/getsockname/recvfrom/recvmsg/read - add/fix ELF_PLATFORM ofr aarch64 and arm - fix "may be used uninitialized" warnings - Fix breakpoint support in Nios - Nicer strace output of chroot() syscall # gpg: Signature made Thu 07 Mar 2019 10:06:16 GMT # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-4.0-pull-request: linux-user: add new netlink types linux-user: Nicer strace output of chroot() syscall linux-user: fix "may be used uninitialized" warnings linux-user: don't short-circuit read with zero length Fix breakpoint support in Nios II user-mode emulation. linux-user: fix emulation of accept4/getpeername/getsockname/recvfrom syscalls linux-user: Fix ELF_PLATFORM for aarch64_be-linux-user linux-user: Add ELF_PLATFORM for arm linux-user: fix recvmsg emulation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r--linux-user/elfload.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 6e8762b40d..c1a26021f8 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -500,13 +500,48 @@ static uint32_t get_elf_hwcap2(void)
#undef GET_FEATURE
#undef GET_FEATURE_ID
+#define ELF_PLATFORM get_elf_platform()
+
+static const char *get_elf_platform(void)
+{
+ CPUARMState *env = thread_cpu->env_ptr;
+
+#ifdef TARGET_WORDS_BIGENDIAN
+# define END "b"
+#else
+# define END "l"
+#endif
+
+ if (arm_feature(env, ARM_FEATURE_V8)) {
+ return "v8" END;
+ } else if (arm_feature(env, ARM_FEATURE_V7)) {
+ if (arm_feature(env, ARM_FEATURE_M)) {
+ return "v7m" END;
+ } else {
+ return "v7" END;
+ }
+ } else if (arm_feature(env, ARM_FEATURE_V6)) {
+ return "v6" END;
+ } else if (arm_feature(env, ARM_FEATURE_V5)) {
+ return "v5" END;
+ } else {
+ return "v4" END;
+ }
+
+#undef END
+}
+
#else
/* 64 bit ARM definitions */
#define ELF_START_MMAP 0x80000000
#define ELF_ARCH EM_AARCH64
#define ELF_CLASS ELFCLASS64
-#define ELF_PLATFORM "aarch64"
+#ifdef TARGET_WORDS_BIGENDIAN
+# define ELF_PLATFORM "aarch64_be"
+#else
+# define ELF_PLATFORM "aarch64"
+#endif
static inline void init_thread(struct target_pt_regs *regs,
struct image_info *infop)