From patchwork Wed Jan 24 21:12:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 865482 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zRdGJ6kL4z9s7s for ; Thu, 25 Jan 2018 08:14:32 +1100 (AEDT) Received: from localhost ([::1]:46681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSNL-0007uE-1L for incoming@patchwork.ozlabs.org; Wed, 24 Jan 2018 16:14:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeSMV-0007pN-3H for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeSMS-0006XR-Nd for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:39 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:55822) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeSMS-0006X1-69 for qemu-devel@nongnu.org; Wed, 24 Jan 2018 16:13:36 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Ls9b5-1emk600CJb-013uKg; Wed, 24 Jan 2018 22:13:07 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 24 Jan 2018 22:12:58 +0100 Message-Id: <20180124211301.10095-2-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180124211301.10095-1-laurent@vivier.eu> References: <20180124211301.10095-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K0:G+7VOANSjW3hCXfYVufaJ3OmulDNcvaTHFIOaNaK9qmHlpOeWPV 3fqKX/dFZtTvHXZbeuzUf9kttuyXXdBBUt/oZ9+sLF3A/4ISyMw9XcVcquIAN/rWAJIt8gQ rz0EWZRSV8CV55KbnRb98rLS8YEN7iBFjcKZzEVSpQCUmc6P13IGglWcKxedKMQit9CVx/P JJ87JhXMHcZoAQMEQNCqg== X-UI-Out-Filterresults: notjunk:1; V01:K0:tbWX7GLsPe4=:ACJhoNkdipaZQ1sN0lijBH mZtzaHduM2Hb+XHQuvf567D9QhIkWU4QQSYeBjjwKuD2xeTtLX6UTmInUTT7EcHTW0GUpPhds /wYaLpJvSRD7qumt9nLDp5ow6eUcIVappiUhuuWBu7+v60TzGSGd8DqxpdpSXZDm3QsDJag+5 rCymSlcmkYyKBmt9oBMMoMaY8Lmqx9JYnRqlBNs1/hlrf/XPUVWN16y0myuLHQcre30q7eqHZ JnXTVg1c9l6O0UQS2GlsneLdUE5p1Cmx85KEUbkw0q7eo0w7CTQKeMYUL0afIYYZqYZj6BwTX R03G+ZLcBT8li6MiCibhtj1IsqWF38x902Y6W3D3KhpkymDwxkXzZoIMJBZAP8+Zhuzon5uZT 2627p273zcv6F+gqaqErz1Nyr6NNz/eYb6zvAHwTEuYIUhlu7nqh9eG+d4ujTEQPeZZ7gEGkg iW0yurapquAGXDqGZyXxyllGCKIDiPuqZjGayZC5UlpDCTME5ZZ6fmvjVw8BFWti6BhsO4BtY ImFnIVJIv3Mv/6a+dXJNTdAUhq6+HpdgkKGCndJGRG8DT77eelzqUxvuueEqk3hUs3Am7EPXo sm3x4ZPmceAOU1NPuGbk/xImYSTBceokzUHSgX274bTPA+7nEfPTzq0cz2MnYf67nRUJOz07+ HnCRWkuFSRYT/38cLae9q/GScsUaCYL6XW8j8xRd6WHKUKoewGoFqbPox7jJvzgITlO4n7Q1h NZi3FhjXpMmvxdq9LqwT4A/XKWGHXt3vpsjaOYOhjqLeg57JmjbN5H4TvRM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PATCH v4 1/4] linux-user: Move CPU type name selection to a function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , YunQiang Su , Riku Voipio , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Igor Mammedov , Aaron Sierra Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Instead of a sequence of "#if ... #endif" move the selection to a function in linux-user/*/target_elf.h We can't add them in linux-user/*/target_cpu.h because we will need to include "elf.h" to use ELF flags with eflags, and including "elf.h" in "target_cpu.h" introduces some conflicts in elfload.c Suggested-by: Richard Henderson Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- linux-user/aarch64/target_elf.h | 14 +++++++++++++ linux-user/alpha/target_elf.h | 14 +++++++++++++ linux-user/arm/target_elf.h | 14 +++++++++++++ linux-user/cris/target_elf.h | 14 +++++++++++++ linux-user/hppa/target_elf.h | 14 +++++++++++++ linux-user/i386/target_elf.h | 14 +++++++++++++ linux-user/m68k/target_elf.h | 14 +++++++++++++ linux-user/main.c | 41 ++------------------------------------ linux-user/microblaze/target_elf.h | 14 +++++++++++++ linux-user/mips/target_elf.h | 14 +++++++++++++ linux-user/mips64/target_elf.h | 14 +++++++++++++ linux-user/nios2/target_elf.h | 14 +++++++++++++ linux-user/openrisc/target_elf.h | 14 +++++++++++++ linux-user/ppc/target_elf.h | 18 +++++++++++++++++ linux-user/s390x/target_elf.h | 14 +++++++++++++ linux-user/sh4/target_elf.h | 14 +++++++++++++ linux-user/sparc/target_elf.h | 14 +++++++++++++ linux-user/sparc64/target_elf.h | 14 +++++++++++++ linux-user/tilegx/target_elf.h | 14 +++++++++++++ linux-user/unicore32/target_elf.h | 14 +++++++++++++ linux-user/x86_64/target_elf.h | 14 +++++++++++++ 21 files changed, 286 insertions(+), 39 deletions(-) create mode 100644 linux-user/aarch64/target_elf.h create mode 100644 linux-user/alpha/target_elf.h create mode 100644 linux-user/arm/target_elf.h create mode 100644 linux-user/cris/target_elf.h create mode 100644 linux-user/hppa/target_elf.h create mode 100644 linux-user/i386/target_elf.h create mode 100644 linux-user/m68k/target_elf.h create mode 100644 linux-user/microblaze/target_elf.h create mode 100644 linux-user/mips/target_elf.h create mode 100644 linux-user/mips64/target_elf.h create mode 100644 linux-user/nios2/target_elf.h create mode 100644 linux-user/openrisc/target_elf.h create mode 100644 linux-user/ppc/target_elf.h create mode 100644 linux-user/s390x/target_elf.h create mode 100644 linux-user/sh4/target_elf.h create mode 100644 linux-user/sparc/target_elf.h create mode 100644 linux-user/sparc64/target_elf.h create mode 100644 linux-user/tilegx/target_elf.h create mode 100644 linux-user/unicore32/target_elf.h create mode 100644 linux-user/x86_64/target_elf.h diff --git a/linux-user/aarch64/target_elf.h b/linux-user/aarch64/target_elf.h new file mode 100644 index 0000000000..a7eb962fba --- /dev/null +++ b/linux-user/aarch64/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef AARCH64_TARGET_ELF_H +#define AARCH64_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/alpha/target_elf.h b/linux-user/alpha/target_elf.h new file mode 100644 index 0000000000..344e9f4d39 --- /dev/null +++ b/linux-user/alpha/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef ALPHA_TARGET_ELF_H +#define ALPHA_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/arm/target_elf.h b/linux-user/arm/target_elf.h new file mode 100644 index 0000000000..58ff6a0986 --- /dev/null +++ b/linux-user/arm/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef ARM_TARGET_ELF_H +#define ARM_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/cris/target_elf.h b/linux-user/cris/target_elf.h new file mode 100644 index 0000000000..99eb4ec704 --- /dev/null +++ b/linux-user/cris/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef CRIS_TARGET_ELF_H +#define CRIS_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/hppa/target_elf.h b/linux-user/hppa/target_elf.h new file mode 100644 index 0000000000..82b4e9535e --- /dev/null +++ b/linux-user/hppa/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef HPPA_TARGET_ELF_H +#define HPPA_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/i386/target_elf.h b/linux-user/i386/target_elf.h new file mode 100644 index 0000000000..1c6142e7da --- /dev/null +++ b/linux-user/i386/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef I386_TARGET_ELF_H +#define I386_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "qemu32"; +} +#endif diff --git a/linux-user/m68k/target_elf.h b/linux-user/m68k/target_elf.h new file mode 100644 index 0000000000..df375ad5d3 --- /dev/null +++ b/linux-user/m68k/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef M68K_TARGET_ELF_H +#define M68K_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/main.c b/linux-user/main.c index 450eb3ce65..3954e8996b 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -35,6 +35,7 @@ #include "elf.h" #include "exec/log.h" #include "trace/control.h" +#include "target_elf.h" char *exec_path; @@ -4319,45 +4320,7 @@ int main(int argc, char **argv, char **envp) init_qemu_uname_release(); if (cpu_model == NULL) { -#if defined(TARGET_I386) -#ifdef TARGET_X86_64 - cpu_model = "qemu64"; -#else - cpu_model = "qemu32"; -#endif -#elif defined(TARGET_ARM) - cpu_model = "any"; -#elif defined(TARGET_UNICORE32) - cpu_model = "any"; -#elif defined(TARGET_M68K) - cpu_model = "any"; -#elif defined(TARGET_SPARC) -#ifdef TARGET_SPARC64 - cpu_model = "TI UltraSparc II"; -#else - cpu_model = "Fujitsu MB86904"; -#endif -#elif defined(TARGET_MIPS) -#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) - cpu_model = "5KEf"; -#else - cpu_model = "24Kf"; -#endif -#elif defined TARGET_OPENRISC - cpu_model = "or1200"; -#elif defined(TARGET_PPC) -# ifdef TARGET_PPC64 - cpu_model = "POWER8"; -# else - cpu_model = "750"; -# endif -#elif defined TARGET_SH4 - cpu_model = "sh7785"; -#elif defined TARGET_S390X - cpu_model = "qemu"; -#else - cpu_model = "any"; -#endif + cpu_model = cpu_get_model(0); } tcg_exec_init(0); /* NOTE: we need to init the CPU at this stage to get diff --git a/linux-user/microblaze/target_elf.h b/linux-user/microblaze/target_elf.h new file mode 100644 index 0000000000..8a8f1debff --- /dev/null +++ b/linux-user/microblaze/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef MICROBLAZE_TARGET_ELF_H +#define MICROBLAZE_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h new file mode 100644 index 0000000000..bed0b43259 --- /dev/null +++ b/linux-user/mips/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef MIPS_TARGET_ELF_H +#define MIPS_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "24Kf"; +} +#endif diff --git a/linux-user/mips64/target_elf.h b/linux-user/mips64/target_elf.h new file mode 100644 index 0000000000..5b6f4692e0 --- /dev/null +++ b/linux-user/mips64/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef MIPS64_TARGET_ELF_H +#define MIPS64_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "5KEf"; +} +#endif diff --git a/linux-user/nios2/target_elf.h b/linux-user/nios2/target_elf.h new file mode 100644 index 0000000000..801e20afaf --- /dev/null +++ b/linux-user/nios2/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef NIOS2_TARGET_ELF_H +#define NIOS2_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/openrisc/target_elf.h b/linux-user/openrisc/target_elf.h new file mode 100644 index 0000000000..40ceb025c9 --- /dev/null +++ b/linux-user/openrisc/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef OPENRISC_TARGET_ELF_H +#define OPENRISC_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "or1200"; +} +#endif diff --git a/linux-user/ppc/target_elf.h b/linux-user/ppc/target_elf.h new file mode 100644 index 0000000000..576a5b9959 --- /dev/null +++ b/linux-user/ppc/target_elf.h @@ -0,0 +1,18 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef PPC_TARGET_ELF_H +#define PPC_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ +#ifdef TARGET_PPC64 + return "POWER8"; +#else + return "750"; +#endif +} +#endif diff --git a/linux-user/s390x/target_elf.h b/linux-user/s390x/target_elf.h new file mode 100644 index 0000000000..8114b59c1d --- /dev/null +++ b/linux-user/s390x/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef S390X_TARGET_ELF_H +#define S390X_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "qemu"; +} +#endif diff --git a/linux-user/sh4/target_elf.h b/linux-user/sh4/target_elf.h new file mode 100644 index 0000000000..f485e0cef2 --- /dev/null +++ b/linux-user/sh4/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef SH4_TARGET_ELF_H +#define SH4_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "sh7785"; +} +#endif diff --git a/linux-user/sparc/target_elf.h b/linux-user/sparc/target_elf.h new file mode 100644 index 0000000000..31d508c0df --- /dev/null +++ b/linux-user/sparc/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef SPARC_TARGET_ELF_H +#define SPARC_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "Fujitsu MB86904"; +} +#endif diff --git a/linux-user/sparc64/target_elf.h b/linux-user/sparc64/target_elf.h new file mode 100644 index 0000000000..d6e388f1cf --- /dev/null +++ b/linux-user/sparc64/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef SPARC64_TARGET_ELF_H +#define SPARC64_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "TI UltraSparc II"; +} +#endif diff --git a/linux-user/tilegx/target_elf.h b/linux-user/tilegx/target_elf.h new file mode 100644 index 0000000000..7197bb0005 --- /dev/null +++ b/linux-user/tilegx/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef TILEGX_TARGET_ELF_H +#define TILEGX_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/unicore32/target_elf.h b/linux-user/unicore32/target_elf.h new file mode 100644 index 0000000000..e2bfcb2ca3 --- /dev/null +++ b/linux-user/unicore32/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef UNICORE32_TARGET_ELF_H +#define UNICORE32_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "any"; +} +#endif diff --git a/linux-user/x86_64/target_elf.h b/linux-user/x86_64/target_elf.h new file mode 100644 index 0000000000..7b76a90de8 --- /dev/null +++ b/linux-user/x86_64/target_elf.h @@ -0,0 +1,14 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation, or (at your option) any + * later version. See the COPYING file in the top-level directory. + */ + +#ifndef X86_64_TARGET_ELF_H +#define X86_64_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "qemu64"; +} +#endif