From nobody Sun Sep 28 16:30:43 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1756403689; cv=none; d=zohomail.com; s=zohoarc; b=gTj84WCfyvMj/3tUsc1uTsCSoek1NaBok8AXLIUxuYNYe5Y53MWPH93Ae+7DEqL3tXiKZ88aqk0GbEsk75wmCQhvySUS2yxZdqNsmETSzSRq2ESMbsmBV3DMHIkqxJFcHpghsjkCTl6nUTKd+xvSa34hPjy5xLRAZUe4XVpity0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756403689; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wZDPXdfsmxBIOUaB++qruH/yHWhEuoUSA6jOwZM9P+A=; b=EWs6MsSHjqFHrt7dXyvu0FgUugryb+ExoHTcPc7tD+w6UQPRwU441h4sEt+O3c4EqEIhtt61zw/w4+fMy+/eV4G8dE+hl2vmrd56cBOQAu/TBBnJk11SbfXqLRXwYB79bbwKIasqMuKHkIagoCAXKKQJqEhvbX6tFeKuT+pghz4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756403689586492.21249014475984; Thu, 28 Aug 2025 10:54:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urgEA-0005jy-Oi; Thu, 28 Aug 2025 13:15:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urbWr-0008PF-Ni for qemu-devel@nongnu.org; Thu, 28 Aug 2025 08:14:59 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1urbWo-0008R2-5f for qemu-devel@nongnu.org; Thu, 28 Aug 2025 08:14:57 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-7720f23123dso837919b3a.2 for ; Thu, 28 Aug 2025 05:14:53 -0700 (PDT) Received: from stoup.. ([144.6.121.55]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-248e3e0b75esm15129025ad.8.2025.08.28.05.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 05:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756383292; x=1756988092; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wZDPXdfsmxBIOUaB++qruH/yHWhEuoUSA6jOwZM9P+A=; b=UxkejWnlCRQHNWBdPIYH1am0yOTVgggYcQPuIj1yeborabubyYEAUSr/RcYKN75IaI Q4kLnmofbDKOZd0qYPWtaKOzNykfKdfo85fl30j+Vj9KKVgXMfk9OdyomLFXzWkFtK4s k8/pys0hCpcVvpr3jA14kJS8ag8dgh+WHmwMG1gE1sGjrXIe/Ne0+g4KYyMs/4xb99Nh ku7TTqGQB8HWhJusaghLxFq2Io3O1eS+BwOAs/qlhKWC2i8QfLCS/CKOkhEvYfdtVASn 1xDYs+2iMU9O5u3bqDh3SNZ0x69tOxbCs8HG5CAfuoKLOctGJfWniAmukIC6Y/aYseIc K6EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756383292; x=1756988092; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wZDPXdfsmxBIOUaB++qruH/yHWhEuoUSA6jOwZM9P+A=; b=MgoiGY5TZSnpBf1rfyO2c7IuXzbRE/rRxKflgea38S1NdnR6m827uCddF/jHpdcJv3 ggDG2BlUunx6n+iBiaMMdHBRvySiZiteEnPMkbEndyzQlQuViwb4dxVSWbJNldPj5WUk E7pUwPXqi0+o26DfpXFjOxt0u8Ho6rVV+/bMnncp7j5qAF58k02mkFeofYPukBD/4mM2 dEHyCJMR5kbgjDLxeST43zWDkLlVFHDwKFyfcWsIi9fO5vg/HP711R3DJE1bwrq8Bweo jsItFEj76QHvpAkxFJ/Jd8F5v+CGGBVFDM0fqy4aLFKaGtARiZqMIxzbSq02wDlBKcgB 039A== X-Gm-Message-State: AOJu0Yz73yy+q0OkwZGMxDCjdjW9053q046YnOo07esjrIjZ9hNYV/bF WGAh6ElVsbBlbtZXy3y4PQO4zDffQRsdfszur+py/gYLP7ojsJpVIb4Gt0KC9aPMTVgc7jIov21 tZcrWbHI= X-Gm-Gg: ASbGncvcSWLqFroIuIMyreWo6J4VZD4IwNFCeUF89Ojr6CH5dckYfKS32pz7rIBl3xt Ylgc9DboQdwQVaT5YrTL3mTf1OdnnodE46iR2MAmUVgb34jUKYPMYl6EPLu9laqGwjBVuFAvZBQ fp+QbS1dMNTk8tBKlfFkHPtQL0cOql3+O6kcaMuukrkfkXZY55TxHBUv1nqJlZRP3MnpvUkYM0p Rk+7YY0wvJsDWpyO3KXu4/Z8vTPzDs0nPww888wo7U1enaaJdg9bE9cu+zPBeBXSuoYJFN2fVLV 5x7/H/42lq/1ZItwO7PcX0SObMU5nKIVwJLXKkqQHeK4yTHMmzdI/vxBpeaNa+yj/Rzmby3FcX8 a1h0GV5I06UROeHutMHXoULfPiGHnQo9PaseO X-Google-Smtp-Source: AGHT+IFgEq/lRrKD5XJahb3EGmlaKRQGJoue/3BYozyO2kbr99Z6Mz1mc074zCR6u8NPQeHW4HBPAA== X-Received: by 2002:a17:902:e80c:b0:246:b3d4:5c82 with SMTP id d9443c01a7336-246b3d4620amr244281685ad.16.1756383292496; Thu, 28 Aug 2025 05:14:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH v3 67/87] linux-user: Move elf parameters to ppc/target_elf.h Date: Thu, 28 Aug 2025 22:08:16 +1000 Message-ID: <20250828120836.195358-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250828120836.195358-1-richard.henderson@linaro.org> References: <20250828120836.195358-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1756403691950124100 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/ppc/target_elf.h | 43 ++++++++++++++++++++++++++++++ linux-user/elfload.c | 53 ------------------------------------- 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/linux-user/ppc/target_elf.h b/linux-user/ppc/target_elf.h index 2a61cd2896..9a47f18fb8 100644 --- a/linux-user/ppc/target_elf.h +++ b/linux-user/ppc/target_elf.h @@ -10,6 +10,17 @@ =20 #include "target_ptrace.h" =20 +#define ELF_MACHINE PPC_ELF_MACHINE + +#ifdef TARGET_PPC64 +# define elf_check_arch(x) ((x) =3D=3D 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; =20 +#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 PP= C, + * even if DLINFO_ARCH_ITEMS goes to zero or is undefined. + */ +#define DLINFO_ARCH_ITEMS 5 +#define ARCH_DLINFO \ + do { \ + PowerPCCPU *cpu =3D 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 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index ccdd87aa12..526c90e2c1 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; =20 -#ifdef TARGET_PPC - -#define ELF_MACHINE PPC_ELF_MACHINE - -#if defined(TARGET_PPC64) - -#define elf_check_arch(x) ( (x) =3D=3D 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 PP= C, - * even if DLINFO_ARCH_ITEMS goes to zero or is undefined. - */ -#define DLINFO_ARCH_ITEMS 5 -#define ARCH_DLINFO \ - do { \ - PowerPCCPU *cpu =3D 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 =20 #define ELF_CLASS ELFCLASS64 --=20 2.43.0