From patchwork Thu May 3 21:38:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 134923 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp87626lji; Thu, 3 May 2018 14:42:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZprCWoCiKyG8j9WGWEngXHUp2qMB2BSPEPhfIbTxM9CGr6qSm4+bsBn3+38PRZjmWTQk/Zf X-Received: by 2002:aed:2984:: with SMTP id o4-v6mr21462046qtd.124.1525383753070; Thu, 03 May 2018 14:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525383753; cv=none; d=google.com; s=arc-20160816; b=B0vcPY+MTHXQzvsThWXr5XE4PV2+XHFKbMTTJJcTLuUQZ/oTaTOcy4TPqSx4nHZM8S ZgmZwayHggoeYWwEumjfTKfpzIV7LcVtuf6KTb1Te9lORJZpqwxMckyO2Bn2s0zMonPz G6rzj1nag3Ye8vdzmVVoC8OzXFRY6ZfDWFxBXfO7TOqzu37J52OK1hlplhSnCOfgrLbO a1QogCXKpG3X9ZGK8/zaGrzGGTG32LQgxBC+TJwIzFU4L5ei7+c7pcVX3Jbq5KiR2vN4 MddeJ2ZYHDnpJiyalmYd7klFQixq3R92GJa/F63uM7DI/rIiYuIVYIFEHVVpKRV19pCI hNqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=T0x84AvfFQFKTBe2C9nXINDxWvlYKAiIDSF4WQs5XEs=; b=C1kymhZDaP9BKJ7DUx9uAFI5s783PTmlZnLgPVVWfK18X+/yH6yEmpEOLXc0VoSJ50 Q4P/wzc2dknaTfTD2gAX/5sz3gpvXLmB9pi9+XcnNVNxvaj8JutdCy/bpaKl8+D4fRvm z4wImAUVrWrIlOQeU4fBcSPmxtaX0iNuIH+0fIVr45Onkkt9u5pH5iteUqG54vEFRALh TJJzRNGW1tgnGwJ6wfOq6r38cw9iDcPl98Q06opjFi5Pz/jaAwJQB3FLo97Lg/df3BED gv4z4/gJgawYxU7UDWJk2CVZp4Oge0+fyQ2bU0eSnUPXwQG8htAOqDYRNR13v2DSmeyw ERPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y9-v6si1785425qtf.398.2018.05.03.14.42.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 03 May 2018 14:42:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:59213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fELzk-0007Qj-GT for patch@linaro.org; Thu, 03 May 2018 17:42:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fELwo-0004jF-Bz for qemu-devel@nongnu.org; Thu, 03 May 2018 17:39:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fELwk-00055v-CZ for qemu-devel@nongnu.org; Thu, 03 May 2018 17:39:30 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:58883) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fELwk-000542-35 for qemu-devel@nongnu.org; Thu, 03 May 2018 17:39:26 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Mdund-1ezsO23A5N-00PhwJ; Thu, 03 May 2018 23:39:12 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 23:38:58 +0200 Message-Id: <20180503213903.30335-2-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503213903.30335-1-laurent@vivier.eu> References: <20180503213903.30335-1-laurent@vivier.eu> X-Provags-ID: V03:K1:87NQNua0dHp7eh3yi1/MBklG7Ft4P6KZzFrh+7KxpuTjbMidmPl AiIVfpXpy53Fh+06ZSPTLzG5YgDpVTpjpDFWBpBiN5eP1HpHbXHoZhd2b9nlx6OTwmPxrOJ IlZychUISu2tB9XoLy7BMuOWS8QMHeiFPid6cvxbnDqIWm+i7gPqzMH4hEZLtJmzxJzRbKh heiFNgvIzeIvybL+BmvAQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:bEuhkjQWoeo=:ZHeaB3H5yMpMZ5LNmOkFFF muwxj6VlcwFNYYywT+L2iHCFKOWiQGnyel/SfYfx8MaGDaaXNKX9masYhjYp0bWiiLpRF/LhS iYBC6ntnbYYS6/UV15ce9QdSAe1cRsC3BrvaGrAVje1Ukc9r6h9WmrhfYe6QY7sm+1TTviQTA AZJafCdO6obvXedibKoxSrT5OoUd5/KN3DyahawVC8xl0BjnjWZcTSgtkRSHxcTEqfbnVkR2i qTQYux1D0eh2eCvUvJo9SMt4OvafXfMPvBqBswlNvDo7uEcsg5out1TrnmnCH/kxyfLCn8U5X NZp6lOoQGiysisp5lNifU7MqqQ6tdgGZ8+Bu1i/7RXHFIB/kH/2tIE3V+ZYfmphXVE2Evue+D q6ZTKObmd3aEOBbJ/lBa+eoact9YkOZDfWinQ42PqV6XCQ/drsXIonWF85ClUfrwZ3N3nct06 Sradw7avZ2bNTJ68fbGl0UWdz89RdFJLlSpw4WcbRwV0uYObGFKkfxIDvw/GeX+HJ9ZSfBy32 kl9qH2u/LjZYcCWe0gdipzoJS4cXN5UlmLYSbUvllLUorZnTkZ5Kp6dYMjSr/jnPWV7OrZNJX M+G2w77g/eJHCzaivmP/JucmJIbma9B1tO1/3mMRfhBoyx2Kls9rjrEyNZN2McIFJGYVMpblR pnFpVRb8DCui1nTzUgEMa5c6Sbjk8oLaz+/LEhuiXPL0uDnKry2AiOaRXStDtRebBC7E= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [PULL 1/6] 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: , Cc: Christophe Lyon , Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Christophe Lyon 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 Reviewed-by: Peter Maydell Message-Id: <20180430080404.7323-2-christophe.lyon@st.com> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 18 +++++++----------- linux-user/qemu.h | 4 ++-- 2 files changed, 9 insertions(+), 13 deletions(-) -- 2.14.3 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c77ed1bb01..bbe93b03b6 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1681,7 +1681,12 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot) } } -#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_ulong sp) { uint16_t n; @@ -1706,7 +1711,6 @@ static abi_ulong loader_build_fdpic_loadmap(struct image_info *info, abi_ulong s return sp; } -#endif 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 argc, int envc, sp = p; -#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 argc, int envc, sp = loader_build_fdpic_loadmap(interp_info, sp); } } -#endif u_platform = 0; k_platform = ELF_PLATFORM; @@ -2153,10 +2155,8 @@ static void load_elf_image(const char *image_name, int image_fd, } bswap_phdr(phdr, ehdr->e_phnum); -#ifdef CONFIG_USE_FDPIC info->nsegs = 0; info->pt_dynamic_addr = 0; -#endif mmap_lock(); @@ -2173,9 +2173,7 @@ static void load_elf_image(const char *image_name, int image_fd, if (a > hiaddr) { hiaddr = a; } -#ifdef CONFIG_USE_FDPIC ++info->nsegs; -#endif } } @@ -2200,8 +2198,7 @@ static void load_elf_image(const char *image_name, int image_fd, } load_bias = load_addr - loaddr; -#ifdef CONFIG_USE_FDPIC - { + if (elf_is_fdpic(ehdr)) { struct elf32_fdpic_loadseg *loadsegs = info->loadsegs = g_malloc(sizeof(*loadsegs) * info->nsegs); @@ -2219,7 +2216,6 @@ static void load_elf_image(const char *image_name, int image_fd, } } } -#endif info->load_bias = load_bias; info->load_addr = load_addr; diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 192a0d2fef..da3b51724c 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 }; #ifdef TARGET_I386