qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: [PATCH v2 05/95] linux-user: Move get_elf_cpu_model to target/elfload.c
Date: Sun,  3 Aug 2025 09:03:29 +1000	[thread overview]
Message-ID: <20250802230459.412251-6-richard.henderson@linaro.org> (raw)
In-Reply-To: <20250802230459.412251-1-richard.henderson@linaro.org>

Rename from cpu_get_model to emphasize that this is an elf-specific
function.  Declare the function once in loader.h.

This frees up target_elf.h for other uses.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/aarch64/target_elf.h     |  5 +---
 linux-user/alpha/target_elf.h       |  5 +---
 linux-user/arm/target_elf.h         |  5 +---
 linux-user/hexagon/target_elf.h     | 29 -------------------
 linux-user/hppa/target_elf.h        |  5 +---
 linux-user/i386/target_elf.h        |  5 +---
 linux-user/loader.h                 |  3 ++
 linux-user/loongarch64/target_elf.h |  5 +---
 linux-user/m68k/target_elf.h        |  9 ------
 linux-user/microblaze/target_elf.h  |  5 +---
 linux-user/mips/target_elf.h        | 11 +-------
 linux-user/mips64/target_elf.h      | 27 +-----------------
 linux-user/openrisc/target_elf.h    |  5 +---
 linux-user/ppc/target_elf.h         |  9 +-----
 linux-user/riscv/target_elf.h       |  5 +---
 linux-user/s390x/target_elf.h       |  5 +---
 linux-user/sh4/target_elf.h         |  5 +---
 linux-user/sparc/target_elf.h       |  9 +-----
 linux-user/x86_64/target_elf.h      |  5 +---
 linux-user/xtensa/target_elf.h      |  5 ----
 linux-user/aarch64/elfload.c        | 10 +++++++
 linux-user/alpha/elfload.c          | 10 +++++++
 linux-user/arm/elfload.c            | 10 +++++++
 linux-user/hexagon/elfload.c        | 34 +++++++++++++++++++++++
 linux-user/hppa/elfload.c           | 10 +++++++
 linux-user/i386/elfload.c           | 10 +++++++
 linux-user/loongarch64/elfload.c    | 10 +++++++
 linux-user/m68k/elfload.c           | 17 ++++++++++++
 linux-user/main.c                   |  3 +-
 linux-user/microblaze/elfload.c     | 10 +++++++
 linux-user/mips/elfload.c           | 43 +++++++++++++++++++++++++++++
 linux-user/openrisc/elfload.c       | 10 +++++++
 linux-user/ppc/elfload.c            | 14 ++++++++++
 linux-user/riscv/elfload.c          | 10 +++++++
 linux-user/s390x/elfload.c          | 10 +++++++
 linux-user/sh4/elfload.c            | 10 +++++++
 linux-user/sparc/elfload.c          | 14 ++++++++++
 linux-user/x86_64/elfload.c         | 10 +++++++
 linux-user/xtensa/elfload.c         | 10 +++++++
 39 files changed, 272 insertions(+), 145 deletions(-)

diff --git a/linux-user/aarch64/target_elf.h b/linux-user/aarch64/target_elf.h
index a7eb962fba..d955b3d07f 100644
--- a/linux-user/aarch64/target_elf.h
+++ b/linux-user/aarch64/target_elf.h
@@ -7,8 +7,5 @@
 
 #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
index b77d638f6d..52b68680ad 100644
--- a/linux-user/alpha/target_elf.h
+++ b/linux-user/alpha/target_elf.h
@@ -7,8 +7,5 @@
 
 #ifndef ALPHA_TARGET_ELF_H
 #define ALPHA_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return "ev67";
-}
+
 #endif
diff --git a/linux-user/arm/target_elf.h b/linux-user/arm/target_elf.h
index 58ff6a0986..2abb27a733 100644
--- a/linux-user/arm/target_elf.h
+++ b/linux-user/arm/target_elf.h
@@ -7,8 +7,5 @@
 
 #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/hexagon/target_elf.h b/linux-user/hexagon/target_elf.h
index 36056fc9f0..eccf207f6b 100644
--- a/linux-user/hexagon/target_elf.h
+++ b/linux-user/hexagon/target_elf.h
@@ -18,33 +18,4 @@
 #ifndef HEXAGON_TARGET_ELF_H
 #define HEXAGON_TARGET_ELF_H
 
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    static char buf[32];
-    int err;
-
-    /* For now, treat anything newer than v5 as a v73 */
-    /* FIXME - Disable instructions that are newer than the specified arch */
-    if (eflags == 0x04 ||    /* v5  */
-        eflags == 0x05 ||    /* v55 */
-        eflags == 0x60 ||    /* v60 */
-        eflags == 0x61 ||    /* v61 */
-        eflags == 0x62 ||    /* v62 */
-        eflags == 0x65 ||    /* v65 */
-        eflags == 0x66 ||    /* v66 */
-        eflags == 0x67 ||    /* v67 */
-        eflags == 0x8067 ||  /* v67t */
-        eflags == 0x68 ||    /* v68 */
-        eflags == 0x69 ||    /* v69 */
-        eflags == 0x71 ||    /* v71 */
-        eflags == 0x8071 ||  /* v71t */
-        eflags == 0x73       /* v73 */
-       ) {
-        return "v73";
-    }
-
-    err = snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags);
-    return err >= 0 && err < sizeof(buf) ? buf : "unknown";
-}
-
 #endif
diff --git a/linux-user/hppa/target_elf.h b/linux-user/hppa/target_elf.h
index 19cae8bd65..5826ca2cd2 100644
--- a/linux-user/hppa/target_elf.h
+++ b/linux-user/hppa/target_elf.h
@@ -7,8 +7,5 @@
 
 #ifndef HPPA_TARGET_ELF_H
 #define HPPA_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return "hppa";
-}
+
 #endif
diff --git a/linux-user/i386/target_elf.h b/linux-user/i386/target_elf.h
index 238a9aba73..e6f0d8fa4e 100644
--- a/linux-user/i386/target_elf.h
+++ b/linux-user/i386/target_elf.h
@@ -7,8 +7,5 @@
 
 #ifndef I386_TARGET_ELF_H
 #define I386_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return "max";
-}
+
 #endif
diff --git a/linux-user/loader.h b/linux-user/loader.h
index e102e6f410..75ee9975a0 100644
--- a/linux-user/loader.h
+++ b/linux-user/loader.h
@@ -98,6 +98,9 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,
 
 extern unsigned long guest_stack_size;
 
+/* Note that Elf32 and Elf64 use uint32_t for e_flags. */
+const char *get_elf_cpu_model(uint32_t eflags);
+
 #if defined(TARGET_S390X) || defined(TARGET_AARCH64) || defined(TARGET_ARM)
 uint32_t get_elf_hwcap(void);
 const char *elf_hwcap_str(uint32_t bit);
diff --git a/linux-user/loongarch64/target_elf.h b/linux-user/loongarch64/target_elf.h
index 95c3f05a46..39a08d35d9 100644
--- a/linux-user/loongarch64/target_elf.h
+++ b/linux-user/loongarch64/target_elf.h
@@ -5,8 +5,5 @@
 
 #ifndef LOONGARCH_TARGET_ELF_H
 #define LOONGARCH_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return "la464";
-}
+
 #endif
diff --git a/linux-user/m68k/target_elf.h b/linux-user/m68k/target_elf.h
index 998fe0fe2f..62ff9d38d4 100644
--- a/linux-user/m68k/target_elf.h
+++ b/linux-user/m68k/target_elf.h
@@ -7,14 +7,5 @@
 
 #ifndef M68K_TARGET_ELF_H
 #define M68K_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    if (eflags == 0 || (eflags & EF_M68K_M68000)) {
-        /* 680x0 */
-        return "m68040";
-    }
 
-    /* Coldfire */
-    return "any";
-}
 #endif
diff --git a/linux-user/microblaze/target_elf.h b/linux-user/microblaze/target_elf.h
index 8a8f1debff..bfe2997fd2 100644
--- a/linux-user/microblaze/target_elf.h
+++ b/linux-user/microblaze/target_elf.h
@@ -7,8 +7,5 @@
 
 #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
index 71a32315a8..febf710c7a 100644
--- a/linux-user/mips/target_elf.h
+++ b/linux-user/mips/target_elf.h
@@ -7,14 +7,5 @@
 
 #ifndef MIPS_TARGET_ELF_H
 #define MIPS_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_32R6) {
-        return "mips32r6-generic";
-    }
-    if (eflags & EF_MIPS_NAN2008) {
-        return "P5600";
-    }
-    return "24Kf";
-}
+
 #endif
diff --git a/linux-user/mips64/target_elf.h b/linux-user/mips64/target_elf.h
index 502af9d278..02e6d14840 100644
--- a/linux-user/mips64/target_elf.h
+++ b/linux-user/mips64/target_elf.h
@@ -7,30 +7,5 @@
 
 #ifndef MIPS64_TARGET_ELF_H
 #define MIPS64_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    switch (eflags & EF_MIPS_MACH) {
-    case EF_MIPS_MACH_OCTEON:
-    case EF_MIPS_MACH_OCTEON2:
-    case EF_MIPS_MACH_OCTEON3:
-        return "Octeon68XX";
-    case EF_MIPS_MACH_LS2E:
-        return "Loongson-2E";
-    case EF_MIPS_MACH_LS2F:
-        return "Loongson-2F";
-    case EF_MIPS_MACH_LS3A:
-        return "Loongson-3A1000";
-    default:
-        break;
-    }
-    switch (eflags & EF_MIPS_ARCH) {
-    case EF_MIPS_ARCH_64R6:
-        return "I6400";
-    case EF_MIPS_ARCH_64R2:
-        return "MIPS64R2-generic";
-    default:
-        break;
-    }
-    return "5KEf";
-}
+
 #endif
diff --git a/linux-user/openrisc/target_elf.h b/linux-user/openrisc/target_elf.h
index 265ecd3079..b34f2ff672 100644
--- a/linux-user/openrisc/target_elf.h
+++ b/linux-user/openrisc/target_elf.h
@@ -7,8 +7,5 @@
 
 #ifndef OPENRISC_TARGET_ELF_H
 #define OPENRISC_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return "any";
-}
+
 #endif
diff --git a/linux-user/ppc/target_elf.h b/linux-user/ppc/target_elf.h
index 0616618854..8c0a8ea431 100644
--- a/linux-user/ppc/target_elf.h
+++ b/linux-user/ppc/target_elf.h
@@ -7,12 +7,5 @@
 
 #ifndef PPC_TARGET_ELF_H
 #define PPC_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-#ifdef TARGET_PPC64
-    return "POWER9";
-#else
-    return "750";
-#endif
-}
+
 #endif
diff --git a/linux-user/riscv/target_elf.h b/linux-user/riscv/target_elf.h
index dedd5956f3..bfe86105d0 100644
--- a/linux-user/riscv/target_elf.h
+++ b/linux-user/riscv/target_elf.h
@@ -7,8 +7,5 @@
 
 #ifndef RISCV_TARGET_ELF_H
 #define RISCV_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return "max";
-}
+
 #endif
diff --git a/linux-user/s390x/target_elf.h b/linux-user/s390x/target_elf.h
index 8114b59c1d..e51b053339 100644
--- a/linux-user/s390x/target_elf.h
+++ b/linux-user/s390x/target_elf.h
@@ -7,8 +7,5 @@
 
 #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
index f485e0cef2..d17011bd75 100644
--- a/linux-user/sh4/target_elf.h
+++ b/linux-user/sh4/target_elf.h
@@ -7,8 +7,5 @@
 
 #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
index a510ceb612..7e46748d26 100644
--- a/linux-user/sparc/target_elf.h
+++ b/linux-user/sparc/target_elf.h
@@ -7,12 +7,5 @@
 
 #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
diff --git a/linux-user/x86_64/target_elf.h b/linux-user/x86_64/target_elf.h
index 3f628f8d66..5849f96350 100644
--- a/linux-user/x86_64/target_elf.h
+++ b/linux-user/x86_64/target_elf.h
@@ -7,8 +7,5 @@
 
 #ifndef X86_64_TARGET_ELF_H
 #define X86_64_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return "max";
-}
+
 #endif
diff --git a/linux-user/xtensa/target_elf.h b/linux-user/xtensa/target_elf.h
index a9a3fabd89..2c55c22e14 100644
--- a/linux-user/xtensa/target_elf.h
+++ b/linux-user/xtensa/target_elf.h
@@ -8,9 +8,4 @@
 #ifndef XTENSA_TARGET_ELF_H
 #define XTENSA_TARGET_ELF_H
 
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return XTENSA_DEFAULT_CPU_MODEL;
-}
-
 #endif
diff --git a/linux-user/aarch64/elfload.c b/linux-user/aarch64/elfload.c
index 73fa78ef14..b92442dfeb 100644
--- a/linux-user/aarch64/elfload.c
+++ b/linux-user/aarch64/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "any";
+}
diff --git a/linux-user/alpha/elfload.c b/linux-user/alpha/elfload.c
index 73fa78ef14..1e44475c47 100644
--- a/linux-user/alpha/elfload.c
+++ b/linux-user/alpha/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "ev67";
+}
diff --git a/linux-user/arm/elfload.c b/linux-user/arm/elfload.c
index 73fa78ef14..b92442dfeb 100644
--- a/linux-user/arm/elfload.c
+++ b/linux-user/arm/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "any";
+}
diff --git a/linux-user/hexagon/elfload.c b/linux-user/hexagon/elfload.c
index 73fa78ef14..d8b545032a 100644
--- a/linux-user/hexagon/elfload.c
+++ b/linux-user/hexagon/elfload.c
@@ -1 +1,35 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    static char buf[32];
+    int err;
+
+    /* For now, treat anything newer than v5 as a v73 */
+    /* FIXME - Disable instructions that are newer than the specified arch */
+    if (eflags == 0x04 ||    /* v5  */
+        eflags == 0x05 ||    /* v55 */
+        eflags == 0x60 ||    /* v60 */
+        eflags == 0x61 ||    /* v61 */
+        eflags == 0x62 ||    /* v62 */
+        eflags == 0x65 ||    /* v65 */
+        eflags == 0x66 ||    /* v66 */
+        eflags == 0x67 ||    /* v67 */
+        eflags == 0x8067 ||  /* v67t */
+        eflags == 0x68 ||    /* v68 */
+        eflags == 0x69 ||    /* v69 */
+        eflags == 0x71 ||    /* v71 */
+        eflags == 0x8071 ||  /* v71t */
+        eflags == 0x73       /* v73 */
+       ) {
+        return "v73";
+    }
+
+    err = snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags);
+    return err >= 0 && err < sizeof(buf) ? buf : "unknown";
+}
diff --git a/linux-user/hppa/elfload.c b/linux-user/hppa/elfload.c
index 73fa78ef14..2274fcbde4 100644
--- a/linux-user/hppa/elfload.c
+++ b/linux-user/hppa/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "hppa";
+}
diff --git a/linux-user/i386/elfload.c b/linux-user/i386/elfload.c
index 73fa78ef14..f92adb7308 100644
--- a/linux-user/i386/elfload.c
+++ b/linux-user/i386/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "max";
+}
diff --git a/linux-user/loongarch64/elfload.c b/linux-user/loongarch64/elfload.c
index 73fa78ef14..874dc4c230 100644
--- a/linux-user/loongarch64/elfload.c
+++ b/linux-user/loongarch64/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "la464";
+}
diff --git a/linux-user/m68k/elfload.c b/linux-user/m68k/elfload.c
index 73fa78ef14..561ac5b3b3 100644
--- a/linux-user/m68k/elfload.c
+++ b/linux-user/m68k/elfload.c
@@ -1 +1,18 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+#include "elf.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    if (eflags == 0 || (eflags & EF_M68K_M68000)) {
+        /* 680x0 */
+        return "m68040";
+    }
+
+    /* Coldfire */
+    return "any";
+}
diff --git a/linux-user/main.c b/linux-user/main.c
index 68972f00a1..ad1a29d198 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -49,7 +49,6 @@
 #include "qemu/guest-random.h"
 #include "elf.h"
 #include "trace/control.h"
-#include "target_elf.h"
 #include "user/cpu_loop.h"
 #include "crypto/init.h"
 #include "fd-trans.h"
@@ -809,7 +808,7 @@ int main(int argc, char **argv, char **envp)
     }
 
     if (cpu_model == NULL) {
-        cpu_model = cpu_get_model(get_elf_eflags(execfd));
+        cpu_model = get_elf_cpu_model(get_elf_eflags(execfd));
     }
     cpu_type = parse_cpu_option(cpu_model);
 
diff --git a/linux-user/microblaze/elfload.c b/linux-user/microblaze/elfload.c
index 73fa78ef14..b92442dfeb 100644
--- a/linux-user/microblaze/elfload.c
+++ b/linux-user/microblaze/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "any";
+}
diff --git a/linux-user/mips/elfload.c b/linux-user/mips/elfload.c
index 73fa78ef14..04e3b76740 100644
--- a/linux-user/mips/elfload.c
+++ b/linux-user/mips/elfload.c
@@ -1 +1,44 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+#include "elf.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+#ifdef TARGET_MIPS64
+    switch (eflags & EF_MIPS_MACH) {
+    case EF_MIPS_MACH_OCTEON:
+    case EF_MIPS_MACH_OCTEON2:
+    case EF_MIPS_MACH_OCTEON3:
+        return "Octeon68XX";
+    case EF_MIPS_MACH_LS2E:
+        return "Loongson-2E";
+    case EF_MIPS_MACH_LS2F:
+        return "Loongson-2F";
+    case EF_MIPS_MACH_LS3A:
+        return "Loongson-3A1000";
+    default:
+        break;
+    }
+    switch (eflags & EF_MIPS_ARCH) {
+    case EF_MIPS_ARCH_64R6:
+        return "I6400";
+    case EF_MIPS_ARCH_64R2:
+        return "MIPS64R2-generic";
+    default:
+        break;
+    }
+    return "5KEf";
+#else
+    if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_32R6) {
+        return "mips32r6-generic";
+    }
+    if (eflags & EF_MIPS_NAN2008) {
+        return "P5600";
+    }
+    return "24Kf";
+#endif
+}
diff --git a/linux-user/openrisc/elfload.c b/linux-user/openrisc/elfload.c
index 73fa78ef14..b92442dfeb 100644
--- a/linux-user/openrisc/elfload.c
+++ b/linux-user/openrisc/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "any";
+}
diff --git a/linux-user/ppc/elfload.c b/linux-user/ppc/elfload.c
index 73fa78ef14..7775dc06fa 100644
--- a/linux-user/ppc/elfload.c
+++ b/linux-user/ppc/elfload.c
@@ -1 +1,15 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+#ifdef TARGET_PPC64
+    return "POWER9";
+#else
+    return "750";
+#endif
+}
diff --git a/linux-user/riscv/elfload.c b/linux-user/riscv/elfload.c
index 73fa78ef14..f92adb7308 100644
--- a/linux-user/riscv/elfload.c
+++ b/linux-user/riscv/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "max";
+}
diff --git a/linux-user/s390x/elfload.c b/linux-user/s390x/elfload.c
index 73fa78ef14..989953a247 100644
--- a/linux-user/s390x/elfload.c
+++ b/linux-user/s390x/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "qemu";
+}
diff --git a/linux-user/sh4/elfload.c b/linux-user/sh4/elfload.c
index 73fa78ef14..546034ec07 100644
--- a/linux-user/sh4/elfload.c
+++ b/linux-user/sh4/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "sh7785";
+}
diff --git a/linux-user/sparc/elfload.c b/linux-user/sparc/elfload.c
index 73fa78ef14..243e6f9b66 100644
--- a/linux-user/sparc/elfload.c
+++ b/linux-user/sparc/elfload.c
@@ -1 +1,15 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+#ifdef TARGET_SPARC64
+    return "TI UltraSparc II";
+#else
+    return "Fujitsu MB86904";
+#endif
+}
diff --git a/linux-user/x86_64/elfload.c b/linux-user/x86_64/elfload.c
index 73fa78ef14..f92adb7308 100644
--- a/linux-user/x86_64/elfload.c
+++ b/linux-user/x86_64/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return "max";
+}
diff --git a/linux-user/xtensa/elfload.c b/linux-user/xtensa/elfload.c
index 73fa78ef14..e35ba69a10 100644
--- a/linux-user/xtensa/elfload.c
+++ b/linux-user/xtensa/elfload.c
@@ -1 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+    return XTENSA_DEFAULT_CPU_MODEL;
+}
-- 
2.43.0



  parent reply	other threads:[~2025-08-02 23:06 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-02 23:03 [PATCH v2 00/95] linux-user: Split up elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 01/95] semihosting: Retrieve stack top from image_info Richard Henderson
2025-08-03 10:43   ` Peter Maydell
2025-08-02 23:03 ` [PATCH v2 02/95] semihosting: Initialize heap once per process Richard Henderson
2025-08-03 10:41   ` Peter Maydell
2025-08-03 19:59     ` Richard Henderson
2025-08-02 23:03 ` [PATCH v2 03/95] linux-user: Create target/elfload.c files Richard Henderson
2025-08-02 23:03 ` [PATCH v2 04/95] linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h Richard Henderson
2025-08-03 10:32   ` Peter Maydell
2025-08-02 23:03 ` Richard Henderson [this message]
2025-08-02 23:03 ` [PATCH v2 06/95] linux-user: Move get_elf_hwcap to {i386, x86_64}/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 07/95] linux-user: Move hwcap functions to {arm, aarch64}/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 08/95] linux-user: Move get_elf_hwcap to sparc/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 09/95] linux-user: Move hwcap functions to ppc/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 10/95] linux-user: Move get_elf_hwcap to loongarch64/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 11/95] linux-user: Move get_elf_hwcap to mips/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 12/95] linux-user: Move get_elf_hwcap to sh4/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 13/95] linux-user: Move hwcap functions to s390x/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 14/95] linux-user: Move get_elf_hwcap to riscv/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 15/95] linux-user: Remove ELF_HWCAP Richard Henderson
2025-08-02 23:03 ` [PATCH v2 16/95] linux-user: Remove ELF_HWCAP2 Richard Henderson
2025-08-03 10:44   ` Peter Maydell
2025-08-02 23:03 ` [PATCH v2 17/95] linux-user: Move get_elf_platform to {i386, x86_64}/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 18/95] linux-user/i386: Return const data from get_elf_platform Richard Henderson
2025-08-02 23:03 ` [PATCH v2 19/95] linux-user: Move get_elf_platform to arm/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 20/95] linux-user/loongarch64: Create get_elf_platform Richard Henderson
2025-08-02 23:03 ` [PATCH v2 21/95] linux-user/hppa: " Richard Henderson
2025-08-02 23:03 ` [PATCH v2 22/95] linux-user: Remove ELF_PLATFORM Richard Henderson
2025-08-02 23:03 ` [PATCH v2 23/95] linux-user: Move get_elf_base_platform to mips/elfload.c Richard Henderson
2025-08-02 23:03 ` [PATCH v2 24/95] linux-user: Move target_cpu_copy_regs decl to qemu.h Richard Henderson
2025-08-02 23:03 ` [PATCH v2 25/95] linux-user: Create do_init_main_thread Richard Henderson
2025-08-02 23:03 ` [PATCH v2 26/95] linux-user/i386: Create init_main_thread Richard Henderson
2025-08-03 10:46   ` Peter Maydell
2025-08-02 23:03 ` [PATCH v2 27/95] linux-user/arm: " Richard Henderson
2025-08-03 10:44   ` Peter Maydell
2025-08-02 23:03 ` [PATCH v2 28/95] linux-user/arm: Remove a.out startup remenents Richard Henderson
2025-08-03 10:45   ` Peter Maydell
2025-08-02 23:03 ` [PATCH v2 29/95] linux-user/aarch64: Create init_main_thread Richard Henderson
2025-08-02 23:03 ` [PATCH v2 30/95] linux-user/sparc: " Richard Henderson
2025-08-02 23:03 ` [PATCH v2 31/95] linux-user/ppc: " Richard Henderson
2025-08-02 23:03 ` [PATCH v2 32/95] linux-user/loongarch64: " Richard Henderson
2025-08-02 23:03 ` [PATCH v2 33/95] linux-user/mips: " Richard Henderson
2025-08-02 23:03 ` [PATCH v2 34/95] linux-user/microblaze: " Richard Henderson
2025-08-02 23:03 ` [PATCH v2 35/95] linux-user/openrisc: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 36/95] linux-user/sh4: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 37/95] linux-user/m68k: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 38/95] linux-user/alpha: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 39/95] linux-user/s390x: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 40/95] linux-user/riscv: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 41/95] linux-user/hppa: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 42/95] linux-user/xtensa: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 43/95] linux-user/hexagon: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 44/95] linux-user: Remove do_init_main_thread Richard Henderson
2025-08-02 23:04 ` [PATCH v2 45/95] linux-user: Remove target_elf_greg_t Richard Henderson
2025-08-03 10:59   ` Peter Maydell
2025-08-03 20:11     ` Richard Henderson
2025-08-04  8:54       ` Peter Maydell
2025-08-02 23:04 ` [PATCH v2 46/95] linux-user: Replace tswapreg with tswapl Richard Henderson
2025-08-02 23:04 ` [PATCH v2 47/95] linux-user: Unify elf_core_copy_regs signatures Richard Henderson
2025-08-02 23:04 ` [PATCH v2 48/95] linux-user: Declare elf_core_copy_regs in loader.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 49/95] linux-user: Remove USE_ELF_CORE_DUMP Richard Henderson
2025-08-02 23:04 ` [PATCH v2 50/95] linux-user: Move elf_core_copy_regs to {i386, x86_64}/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 51/95] linux-user: Move elf_core_copy_regs to arm/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 52/95] linux-user: Move elf_core_copy_regs to aarch64/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 53/95] linux-user: Move elf_core_copy_regs to ppc/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 54/95] linux-user: Move elf_core_copy_regs to loongarch64/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 55/95] linux-user: Move elf_core_copy_regs to mips/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 56/95] linux-user: Move elf_core_copy_regs to microblaze/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 57/95] linux-user: Move elf_core_copy_regs to openrisc/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 58/95] linux-user: Move elf_core_copy_regs to sh4/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 59/95] linux-user: Move elf_core_copy_regs to m68k/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 60/95] linux-user: Move elf_core_copy_regs to s390x/elfload.c Richard Henderson
2025-08-03 11:05   ` Peter Maydell
2025-08-02 23:04 ` [PATCH v2 61/95] linux-user: Move elf_core_copy_regs to xtensa/elfload.c Richard Henderson
2025-08-03 11:04   ` Peter Maydell
2025-08-02 23:04 ` [PATCH v2 62/95] linux-user: Move init_guest_commpage to x86_64/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 63/95] linux-user: Move init_guest_commpage to arm/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 64/95] linux-user: Move init_guest_commpage to hppa/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 65/95] linux-user: Replace init_guest_commpage macro with function Richard Henderson
2025-08-02 23:04 ` [PATCH v2 66/95] linux-user: Move get_vdso_image_info to arm/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 67/95] linux-user: Remove ELF_EXEC_PAGESIZE Richard Henderson
2025-08-02 23:04 ` [PATCH v2 68/95] linux-user: Remove redundant ELF_DATA definitons Richard Henderson
2025-08-03 11:04   ` Peter Maydell
2025-08-02 23:04 ` [PATCH v2 69/95] linux-user: Move elf parameters to {i386, x86_64}/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 70/95] linux-user: Move elf parameters to {arm, aarch64}/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 71/95] linux-user: Move elf parameters to sparc/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 72/95] linux-user: Move elf parameters to ppc/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 73/95] linux-user: Move elf parameters to loongarch64/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 74/95] linux-user: Move elf parameters to {mips, mips64}/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 75/95] linux-user: Move elf parameters to microblaze/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 76/95] linux-user: Move elf parameters to openrisc/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 77/95] linux-user: Move elf parameters to sh4/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 78/95] linux-user: Move elf parameters to m68k/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 79/95] linux-user: Move elf parameters to alpha/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 80/95] linux-user: Move elf parameters to s390x/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 81/95] linux-user: Move elf parameters to riscv/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 82/95] linux-user: Move elf parameters to hppa/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 83/95] linux-user: Move elf parameters to xtensa/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 84/95] linux-user: Move elf parameters to hexagon/target_elf.h Richard Henderson
2025-08-02 23:04 ` [PATCH v2 85/95] linux-user: Standardize on ELF_MACHINE not ELF_ARCH Richard Henderson
2025-08-02 23:04 ` [PATCH v2 86/95] linux-user: Rename elf_check_arch Richard Henderson
2025-08-02 23:04 ` [PATCH v2 87/95] linux-user: Remove ELIBBAD from elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 88/95] linux-user: Remove MAP_DENYWRITE " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 89/95] linux-user: Move arch_parse_elf_property to aarch64/elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 90/95] linux-user: Remove a.out declarations from elfload.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 91/95] linux-user/sparc: Move target_pt_regs to signal.c Richard Henderson
2025-08-02 23:04 ` [PATCH v2 92/95] linux-user/microblaze: " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 93/95] linux-user/openrisc: " Richard Henderson
2025-08-03 11:03   ` Peter Maydell
2025-08-02 23:04 ` [PATCH v2 94/95] linux-user/s390x: Move target_psw_t " Richard Henderson
2025-08-02 23:04 ` [PATCH v2 95/95] linux-user: Remove struct target_pt_regs from target_syscall.h Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250802230459.412251-6-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).