From patchwork Tue Jul 27 17:25:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 60029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2CC28B6EFE for ; Wed, 28 Jul 2010 04:44:16 +1000 (EST) Received: from localhost ([127.0.0.1]:51891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Odp8C-0001us-2x for incoming@patchwork.ozlabs.org; Tue, 27 Jul 2010 14:44:00 -0400 Received: from [140.186.70.92] (port=37558 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Odokv-0003kv-37 for qemu-devel@nongnu.org; Tue, 27 Jul 2010 14:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Odokt-0003wB-4m for qemu-devel@nongnu.org; Tue, 27 Jul 2010 14:19:56 -0400 Received: from b.mail.sonic.net ([64.142.19.5]:47232) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Odoks-0003w4-RY for qemu-devel@nongnu.org; Tue, 27 Jul 2010 14:19:55 -0400 Received: from are.twiddle.net (are.twiddle.net [75.101.38.216]) by b.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id o6RHPfGE019962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 27 Jul 2010 10:25:41 -0700 Received: from are.twiddle.net (localhost [127.0.0.1]) by are.twiddle.net (8.14.4/8.14.4) with ESMTP id o6RHPfKl006927 for ; Tue, 27 Jul 2010 10:25:41 -0700 Received: (from rth@localhost) by are.twiddle.net (8.14.4/8.14.4/Submit) id o6RHPfK1006926 for qemu-devel@nongnu.org; Tue, 27 Jul 2010 10:25:41 -0700 From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 27 Jul 2010 10:25:31 -0700 Message-Id: <1280251538-6860-6-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.2 In-Reply-To: <1280251538-6860-1-git-send-email-rth@twiddle.net> References: <1280251538-6860-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Subject: [Qemu-devel] [PATCH 05/12] linux-user: Define ELF_DATA generically. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The only consideration on this value is the target endianness. The existing defines were incorrect for alpha and sh4eb. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 30 ++++++------------------------ 1 files changed, 6 insertions(+), 24 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 4a48c85..a757dc9 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -95,6 +95,12 @@ enum { #define ELIBBAD 80 #endif +#ifdef TARGET_WORDS_BIGENDIAN +#define ELF_DATA ELFDATA2MSB +#else +#define ELF_DATA ELFDATA2LSB +#endif + typedef target_ulong target_elf_greg_t; #ifdef USE_UID16 typedef uint16_t target_uid_t; @@ -132,7 +138,6 @@ static uint32_t get_elf_hwcap(void) #define elf_check_arch(x) ( ((x) == ELF_ARCH) ) #define ELF_CLASS ELFCLASS64 -#define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_X86_64 static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) @@ -196,7 +201,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env) * These are used to set parameters in the core dumps. */ #define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_386 static inline void init_thread(struct target_pt_regs *regs, @@ -259,11 +263,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env) #define elf_check_arch(x) ( (x) == EM_ARM ) #define ELF_CLASS ELFCLASS32 -#ifdef TARGET_WORDS_BIGENDIAN -#define ELF_DATA ELFDATA2MSB -#else -#define ELF_DATA ELFDATA2LSB -#endif #define ELF_ARCH EM_ARM static inline void init_thread(struct target_pt_regs *regs, @@ -352,7 +351,6 @@ enum #endif #define ELF_CLASS ELFCLASS64 -#define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_SPARCV9 #define STACK_BIAS 2047 @@ -382,7 +380,6 @@ static inline void init_thread(struct target_pt_regs *regs, #define elf_check_arch(x) ( (x) == EM_SPARC ) #define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_SPARC static inline void init_thread(struct target_pt_regs *regs, @@ -416,11 +413,6 @@ static inline void init_thread(struct target_pt_regs *regs, #endif -#ifdef TARGET_WORDS_BIGENDIAN -#define ELF_DATA ELFDATA2MSB -#else -#define ELF_DATA ELFDATA2LSB -#endif #define ELF_ARCH EM_PPC /* Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP). @@ -554,11 +546,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env) #else #define ELF_CLASS ELFCLASS32 #endif -#ifdef TARGET_WORDS_BIGENDIAN -#define ELF_DATA ELFDATA2MSB -#else -#define ELF_DATA ELFDATA2LSB -#endif #define ELF_ARCH EM_MIPS static inline void init_thread(struct target_pt_regs *regs, @@ -626,7 +613,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env) #define elf_check_arch(x) ( (x) == EM_MICROBLAZE || (x) == EM_MICROBLAZE_OLD) #define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_MICROBLAZE static inline void init_thread(struct target_pt_regs *regs, @@ -666,7 +652,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env) #define elf_check_arch(x) ( (x) == EM_SH ) #define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_SH static inline void init_thread(struct target_pt_regs *regs, @@ -722,7 +707,6 @@ static inline void elf_core_copy_regs(target_elf_gregset_t *regs, #define elf_check_arch(x) ( (x) == EM_CRIS ) #define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_CRIS static inline void init_thread(struct target_pt_regs *regs, @@ -742,7 +726,6 @@ static inline void init_thread(struct target_pt_regs *regs, #define elf_check_arch(x) ( (x) == EM_68K ) #define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_68K /* ??? Does this need to do anything? @@ -796,7 +779,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUState *env) #define elf_check_arch(x) ( (x) == ELF_ARCH ) #define ELF_CLASS ELFCLASS64 -#define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_ALPHA static inline void init_thread(struct target_pt_regs *regs,