aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2025-07-29 10:24:56 -1000
committerRichard Henderson <richard.henderson@linaro.org>2025-08-30 07:04:04 +1000
commit5408b354552180e42d644dc42b8b565648fad1be (patch)
tree3a30c4f98fdebd532e61cdf4b941526f9bc45b22 /linux-user
parent7b75b5e611d157ec77e4be3ac7f5ff1301380440 (diff)
downloadqemu-5408b354552180e42d644dc42b8b565648fad1be.zip
qemu-5408b354552180e42d644dc42b8b565648fad1be.tar.gz
qemu-5408b354552180e42d644dc42b8b565648fad1be.tar.bz2
linux-user: Move elf parameters to ppc/target_elf.h
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/elfload.c53
-rw-r--r--linux-user/ppc/target_elf.h43
2 files changed, 43 insertions, 53 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index ccdd87a..526c90e 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -130,59 +130,6 @@ typedef abi_uint target_gid_t;
#endif
typedef abi_int target_pid_t;
-#ifdef TARGET_PPC
-
-#define ELF_MACHINE PPC_ELF_MACHINE
-
-#if defined(TARGET_PPC64)
-
-#define elf_check_arch(x) ( (x) == EM_PPC64 )
-
-#define ELF_CLASS ELFCLASS64
-
-#else
-
-#define ELF_CLASS ELFCLASS32
-#define EXSTACK_DEFAULT true
-
-#endif
-
-#define ELF_ARCH EM_PPC
-
-/*
- * The requirements here are:
- * - keep the final alignment of sp (sp & 0xf)
- * - make sure the 32-bit value at the first 16 byte aligned position of
- * AUXV is greater than 16 for glibc compatibility.
- * AT_IGNOREPPC is used for that.
- * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
- * even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
- */
-#define DLINFO_ARCH_ITEMS 5
-#define ARCH_DLINFO \
- do { \
- PowerPCCPU *cpu = POWERPC_CPU(thread_cpu); \
- /* \
- * Handle glibc compatibility: these magic entries must \
- * be at the lowest addresses in the final auxv. \
- */ \
- NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
- NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
- NEW_AUX_ENT(AT_DCACHEBSIZE, cpu->env.dcache_line_size); \
- NEW_AUX_ENT(AT_ICACHEBSIZE, cpu->env.icache_line_size); \
- NEW_AUX_ENT(AT_UCACHEBSIZE, 0); \
- } while (0)
-
-#ifndef TARGET_PPC64
-# define VDSO_HEADER "vdso-32.c.inc"
-#elif TARGET_BIG_ENDIAN
-# define VDSO_HEADER "vdso-64.c.inc"
-#else
-# define VDSO_HEADER "vdso-64le.c.inc"
-#endif
-
-#endif
-
#ifdef TARGET_LOONGARCH64
#define ELF_CLASS ELFCLASS64
diff --git a/linux-user/ppc/target_elf.h b/linux-user/ppc/target_elf.h
index 2a61cd2..9a47f18 100644
--- a/linux-user/ppc/target_elf.h
+++ b/linux-user/ppc/target_elf.h
@@ -10,6 +10,17 @@
#include "target_ptrace.h"
+#define ELF_MACHINE PPC_ELF_MACHINE
+
+#ifdef TARGET_PPC64
+# define elf_check_arch(x) ((x) == EM_PPC64)
+# define ELF_CLASS ELFCLASS64
+#else
+# define ELF_CLASS ELFCLASS32
+# define EXSTACK_DEFAULT true
+#endif
+#define ELF_ARCH EM_PPC
+
#define HAVE_ELF_HWCAP 1
#define HAVE_ELF_HWCAP2 1
#define HAVE_ELF_CORE_DUMP 1
@@ -26,4 +37,36 @@ typedef struct target_elf_gregset_t {
};
} target_elf_gregset_t;
+#ifndef TARGET_PPC64
+# define VDSO_HEADER "vdso-32.c.inc"
+#elif TARGET_BIG_ENDIAN
+# define VDSO_HEADER "vdso-64.c.inc"
+#else
+# define VDSO_HEADER "vdso-64le.c.inc"
+#endif
+
+/*
+ * The requirements here are:
+ * - keep the final alignment of sp (sp & 0xf)
+ * - make sure the 32-bit value at the first 16 byte aligned position of
+ * AUXV is greater than 16 for glibc compatibility.
+ * AT_IGNOREPPC is used for that.
+ * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
+ * even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
+ */
+#define DLINFO_ARCH_ITEMS 5
+#define ARCH_DLINFO \
+ do { \
+ PowerPCCPU *cpu = POWERPC_CPU(thread_cpu); \
+ /* \
+ * Handle glibc compatibility: these magic entries must \
+ * be at the lowest addresses in the final auxv. \
+ */ \
+ NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
+ NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
+ NEW_AUX_ENT(AT_DCACHEBSIZE, cpu->env.dcache_line_size); \
+ NEW_AUX_ENT(AT_ICACHEBSIZE, cpu->env.icache_line_size); \
+ NEW_AUX_ENT(AT_UCACHEBSIZE, 0); \
+ } while (0)
+
#endif