linux-user: Move CPU type name selection to a function
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 <richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180220173307.25125-2-laurent@vivier.eu>
This commit is contained in:
parent
0a773d55ac
commit
542ca43498
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -35,6 +35,7 @@
|
|||
#include "elf.h"
|
||||
#include "exec/log.h"
|
||||
#include "trace/control.h"
|
||||
#include "target_elf.h"
|
||||
|
||||
char *exec_path;
|
||||
|
||||
|
@ -4344,45 +4345,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
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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 SPARC_TARGET_ELF_H
|
||||
#define SPARC_TARGET_ELF_H
|
||||
static inline const char *cpu_get_model(uint32_t eflags)
|
||||
{
|
||||
#ifdef TARGET_SPARC64
|
||||
return "TI UltraSparc II";
|
||||
#else
|
||||
return "Fujitsu MB86904";
|
||||
#endif
|
||||
}
|
||||
#endif
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue