From patchwork Mon Apr 30 08:03:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 134693 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3482200lji; Mon, 30 Apr 2018 01:07:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoWJHG3Ezio7R8B0IFHBNxe1uxG2iLbgfWPkvKzpPMEt/4RcShPKeAYYR78jcvJOMRrFyFX X-Received: by 2002:a0c:9e2c:: with SMTP id p44-v6mr10476138qve.97.1525075653109; Mon, 30 Apr 2018 01:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525075653; cv=none; d=google.com; s=arc-20160816; b=zC/8EKPIj1dtvrFEJKEMBDQULI+bxHtkTLao9zUScixrA37eIUghzjPKKbukTkK2B0 tWQa1czx5ZnLQdlXytAjWUPHIPJ57Qnrwfko1UaD78noF1vyLnJ32RtsSlz2E7k1BOYl XbDRkVULQPZAmOuHKm9+OR7+51pvlLA2QKo444+gY5V1zgInhOTmaX7G1BrF1YQzuBY2 3rKcxUnqzAs9N+G1MUscY8utlwjOjXZVyk2p6zYkIPAsMcUPEURv3bJy4I1JfMJSQfoP IK3GUl6DQex/LKOSddSVsgAthcMkkI3VltB1Rcx3TfrsnD3A37IWBJzKRm0MqV/Go29f q9aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:mime-version:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=3B+IDwYlUdRZPcjAilibwN9TneGTLk/D6rvEEVtLvcM=; b=lpKtCZZTyJvMQ9724Vev4JpGwiw8YceQy1iGxCywuSQgjRmdLeyw647txEUpTubKF5 yRJXRzLIRDbTiXKsKKnVzzHb5T2C/WCsh098u/kt3q1waTS7U887nfwAAGCxQKRF2YfX 8j0kUuYCIsTEN3S7TpuVo9Hv6PRA8l7H31mZsr3bul9V4/R6ArFpIqF9C1RiWZSfUWjq M7doAZyM+ltrEOyTxWjvwM41EVTQBYvbezBxw0JfA8lUlRAxxpxqjt2mS5QdR+bmR/wL P5KrVKT+fRnfY3V0NiUEPPXK1sP6Q/tAea1fvejdX87E+RZ25Q4H0vj1BgLHFAFF8qfv ropg== 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 n7si4132799qke.129.2018.04.30.01.07.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 30 Apr 2018 01:07: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]:58266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fD3qO-0003qu-IN for patch@linaro.org; Mon, 30 Apr 2018 04:07:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fD3ne-0002lj-Qj for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:04:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fD3nb-0002OW-Lh for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:04:42 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:59623 helo=mx07-00178001.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fD3nb-0002OC-Cp for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:04:39 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3U83rSh028505; Mon, 30 Apr 2018 10:04:35 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2hme358505-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 30 Apr 2018 10:04:35 +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 644583D; Mon, 30 Apr 2018 08:04:34 +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 46819252A; Mon, 30 Apr 2018 08:04:34 +0000 (GMT) Received: from gnb.st.com (10.75.127.46) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 30 Apr 2018 10:04:33 +0200 From: Christophe Lyon To: , , , , Date: Mon, 30 Apr 2018 10:03:41 +0200 Message-ID: <20180430080404.7323-2-christophe.lyon@st.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180430080404.7323-1-christophe.lyon@st.com> References: <20180430080404.7323-1-christophe.lyon@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG1NODE3.st.com (10.75.127.3) To SFHDAG5NODE1.st.com (10.75.127.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-30_03:, , signatures=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 91.207.212.93 Subject: [Qemu-devel] [ARM/FDPIC v4 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 -- 2.6.3 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c77ed1b..bbe93b0 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 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 }; #ifdef TARGET_I386