From nobody Tue Feb 10 16:22:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524470181376710.7575951885103; Mon, 23 Apr 2018 00:56:21 -0700 (PDT) Received: from localhost ([::1]:51983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAWKi-000238-K8 for importer@patchew.org; Mon, 23 Apr 2018 03:56:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAWHM-0008Qy-Kk for qemu-devel@nongnu.org; Mon, 23 Apr 2018 03:52:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAWHJ-0000BV-Iv for qemu-devel@nongnu.org; Mon, 23 Apr 2018 03:52:52 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:52170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fAWHJ-0000Ao-9u for qemu-devel@nongnu.org; Mon, 23 Apr 2018 03:52:49 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3N7nVTj027828; Mon, 23 Apr 2018 09:52:41 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2hfu2tsguf-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 23 Apr 2018 09:52:40 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5765C3D; Mon, 23 Apr 2018 07:52:40 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node1.st.com [10.75.127.13]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0D2B811E3; Mon, 23 Apr 2018 07:52:40 +0000 (GMT) Received: from gnb.st.com (10.75.127.48) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 23 Apr 2018 09:52:39 +0200 From: Christophe Lyon To: , , , , Date: Mon, 23 Apr 2018 09:51:52 +0200 Message-ID: <20180423075215.4572-2-christophe.lyon@st.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180423075215.4572-1-christophe.lyon@st.com> References: <20180423075215.4572-1-christophe.lyon@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG4NODE3.st.com (10.75.127.12) To SFHDAG5NODE1.st.com (10.75.127.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-23_04:, , signatures=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 62.209.51.94 Subject: [Qemu-devel] [ARM/FDPIC v2 1/4] Remove CONFIG_USE_FDPIC. 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" We want to avoid code disabled by default, because it ends up less tested. This patch removes all instances of #ifdef CONFIG_USE_FDPIC, most of which can be safely kept. For the ones that should be conditionally executed, we define elf_is_fdpic(). Without this patch, defining CONFIG_USE_FDPIC would prevent QEMU from building precisely because elf_is_fdpic is not defined. Signed-off-by: Christophe Lyon diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c77ed1b..bbe93b0 100644 Reviewed-by: Peter Maydell --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1681,7 +1681,12 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong la= st_bss, int prot) } } =20 -#ifdef CONFIG_USE_FDPIC +/* Default implementation, always false. */ +static int elf_is_fdpic(struct elfhdr *exec) +{ + return 0; +} + static abi_ulong loader_build_fdpic_loadmap(struct image_info *info, abi_u= long sp) { uint16_t n; @@ -1706,7 +1711,6 @@ static abi_ulong loader_build_fdpic_loadmap(struct im= age_info *info, abi_ulong s =20 return sp; } -#endif =20 static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, struct elfhdr *exec, @@ -1725,7 +1729,6 @@ static abi_ulong create_elf_tables(abi_ulong p, int a= rgc, int envc, =20 sp =3D p; =20 -#ifdef CONFIG_USE_FDPIC /* Needs to be before we load the env/argc/... */ if (elf_is_fdpic(exec)) { /* Need 4 byte alignment for these structs */ @@ -1737,7 +1740,6 @@ static abi_ulong create_elf_tables(abi_ulong p, int a= rgc, int envc, sp =3D loader_build_fdpic_loadmap(interp_info, sp); } } -#endif =20 u_platform =3D 0; k_platform =3D ELF_PLATFORM; @@ -2153,10 +2155,8 @@ static void load_elf_image(const char *image_name, i= nt image_fd, } bswap_phdr(phdr, ehdr->e_phnum); =20 -#ifdef CONFIG_USE_FDPIC info->nsegs =3D 0; info->pt_dynamic_addr =3D 0; -#endif =20 mmap_lock(); =20 @@ -2173,9 +2173,7 @@ static void load_elf_image(const char *image_name, in= t image_fd, if (a > hiaddr) { hiaddr =3D a; } -#ifdef CONFIG_USE_FDPIC ++info->nsegs; -#endif } } =20 @@ -2200,8 +2198,7 @@ static void load_elf_image(const char *image_name, in= t image_fd, } load_bias =3D load_addr - loaddr; =20 -#ifdef CONFIG_USE_FDPIC - { + if (elf_is_fdpic(ehdr)) { struct elf32_fdpic_loadseg *loadsegs =3D info->loadsegs =3D g_malloc(sizeof(*loadsegs) * info->nsegs); =20 @@ -2219,7 +2216,6 @@ static void load_elf_image(const char *image_name, in= t image_fd, } } } -#endif =20 info->load_bias =3D load_bias; info->load_addr =3D load_addr; diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 192a0d2..da3b517 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -51,13 +51,13 @@ struct image_info { abi_ulong file_string; uint32_t elf_flags; int personality; -#ifdef CONFIG_USE_FDPIC + + /* The fields below are used in FDPIC mode. */ abi_ulong loadmap_addr; uint16_t nsegs; void *loadsegs; abi_ulong pt_dynamic_addr; struct image_info *other_info; -#endif }; =20 #ifdef TARGET_I386 --=20 2.6.3