[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v1 02/21] linux-user: elfload: Provide default for el
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PULL v1 02/21] linux-user: elfload: Provide default for elf_check_arch |
Date: |
Thu, 10 Sep 2015 22:44:24 -0700 |
For many arch's this macro is defined as the predicatable behaviour
of checking the argument for eqaulity against ELF_ARCH. Provide a
default define as such, so only archs with special handling (usually
allowing multiple EM values) need to provide a def.
Arches that do any of:
1: provide this def exactly the same way as the new default
(alpha, x86_64)
2: check against ELF_MACHINE while defining ELF_ARCH == ELF_MACHINE
(arm, aarch64)
3: check against EM_FOO directly while defining ELF_ARCH == EM_FOO
(unicore32, sparc32, ppc32, mips, openrisc, sh4, cris, m86k)
have their elf_check_arch removed as the default will provide the
correct behaviour.
Reviewed-by: Richard Henderson <address@hidden>
Acked-By: Riku Voipio <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
---
linux-user/elfload.c | 28 ++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 518ff05..1f4c054 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -145,7 +145,6 @@ static uint32_t get_elf_hwcap(void)
#ifdef TARGET_X86_64
#define ELF_START_MMAP 0x2aaaaab000ULL
-#define elf_check_arch(x) ( ((x) == ELF_ARCH) )
#define ELF_CLASS ELFCLASS64
#define ELF_ARCH EM_X86_64
@@ -273,8 +272,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
const CPUX86State *en
#define ELF_START_MMAP 0x80000000
-#define elf_check_arch(x) ((x) == ELF_MACHINE)
-
#define ELF_ARCH ELF_MACHINE
#define ELF_CLASS ELFCLASS32
@@ -481,8 +478,6 @@ static uint32_t get_elf_hwcap2(void)
/* 64 bit ARM definitions */
#define ELF_START_MMAP 0x80000000
-#define elf_check_arch(x) ((x) == ELF_MACHINE)
-
#define ELF_ARCH ELF_MACHINE
#define ELF_CLASS ELFCLASS64
#define ELF_PLATFORM "aarch64"
@@ -556,8 +551,6 @@ static uint32_t get_elf_hwcap(void)
#define ELF_START_MMAP 0x80000000
-#define elf_check_arch(x) ((x) == EM_UNICORE32)
-
#define ELF_CLASS ELFCLASS32
#define ELF_DATA ELFDATA2LSB
#define ELF_ARCH EM_UNICORE32
@@ -666,7 +659,6 @@ static inline void init_thread(struct target_pt_regs *regs,
#define ELF_START_MMAP 0x80000000
#define ELF_HWCAP (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | HWCAP_SPARC_SWAP \
| HWCAP_SPARC_MULDIV)
-#define elf_check_arch(x) ( (x) == EM_SPARC )
#define ELF_CLASS ELFCLASS32
#define ELF_ARCH EM_SPARC
@@ -696,8 +688,6 @@ static inline void init_thread(struct target_pt_regs *regs,
#else
-#define elf_check_arch(x) ( (x) == EM_PPC )
-
#define ELF_CLASS ELFCLASS32
#endif
@@ -875,8 +865,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
const CPUPPCState *en
#define ELF_START_MMAP 0x80000000
-#define elf_check_arch(x) ( (x) == EM_MIPS )
-
#ifdef TARGET_MIPS64
#define ELF_CLASS ELFCLASS64
#else
@@ -985,8 +973,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
const CPUMBState *env
#define ELF_START_MMAP 0x08000000
-#define elf_check_arch(x) ((x) == EM_OPENRISC)
-
#define ELF_ARCH EM_OPENRISC
#define ELF_CLASS ELFCLASS32
#define ELF_DATA ELFDATA2MSB
@@ -1026,8 +1012,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
#define ELF_START_MMAP 0x80000000
-#define elf_check_arch(x) ( (x) == EM_SH )
-
#define ELF_CLASS ELFCLASS32
#define ELF_ARCH EM_SH
@@ -1110,8 +1094,6 @@ static uint32_t get_elf_hwcap(void)
#define ELF_START_MMAP 0x80000000
-#define elf_check_arch(x) ( (x) == EM_CRIS )
-
#define ELF_CLASS ELFCLASS32
#define ELF_ARCH EM_CRIS
@@ -1129,8 +1111,6 @@ static inline void init_thread(struct target_pt_regs
*regs,
#define ELF_START_MMAP 0x80000000
-#define elf_check_arch(x) ( (x) == EM_68K )
-
#define ELF_CLASS ELFCLASS32
#define ELF_ARCH EM_68K
@@ -1182,8 +1162,6 @@ static void elf_core_copy_regs(target_elf_gregset_t
*regs, const CPUM68KState *e
#define ELF_START_MMAP (0x30000000000ULL)
-#define elf_check_arch(x) ( (x) == ELF_ARCH )
-
#define ELF_CLASS ELFCLASS64
#define ELF_ARCH EM_ALPHA
@@ -1203,8 +1181,6 @@ static inline void init_thread(struct target_pt_regs
*regs,
#define ELF_START_MMAP (0x20000000000ULL)
-#define elf_check_arch(x) ( (x) == ELF_ARCH )
-
#define ELF_CLASS ELFCLASS64
#define ELF_DATA ELFDATA2MSB
#define ELF_ARCH EM_S390
@@ -1226,6 +1202,10 @@ static inline void init_thread(struct target_pt_regs
*regs, struct image_info *i
#define ELF_MACHINE ELF_ARCH
#endif
+#ifndef elf_check_arch
+#define elf_check_arch(x) ((x) == ELF_ARCH)
+#endif
+
#ifndef ELF_HWCAP
#define ELF_HWCAP 0
#endif
--
1.9.1
- [Qemu-devel] [PULL v1 00/21] Multi-arch queue, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 01/21] linux_user: elfload: Default ELF_MACHINE to ELF_ARCH, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 03/21] elf_ops: Fix coding style for EM alias case statement, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 02/21] linux-user: elfload: Provide default for elf_check_arch,
Peter Crosthwaite <=
- [Qemu-devel] [PULL v1 05/21] arm: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 04/21] elf: Update EM_MOXIE definition, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 06/21] mb: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 07/21] m68k: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 08/21] cris: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 09/21] moxie: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 10/21] unicore: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 12/21] or32: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 13/21] tricore: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PULL v1 15/21] sh4: Remove ELF_MACHINE from cpu.h, Peter Crosthwaite, 2015/09/11