From patchwork Mon Apr 23 07:51:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 133973 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp700330lji; Mon, 23 Apr 2018 00:56:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoIowBeNBiu1jmcFlEXom4JvkIdd3XFRCedlWs70pJsI+TsBp5Hy22dnFNoQdiOnEFCbVv8 X-Received: by 10.55.60.203 with SMTP id j194mr21323768qka.31.1524470212764; Mon, 23 Apr 2018 00:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524470212; cv=none; d=google.com; s=arc-20160816; b=BwpuMJoO0qbTS9cKHSBZelYimeJJ3xsUnjCfWPrnb4ayZ/I8XqMpRYSpIYQE1GuHQr 0hIWB8MWiD+KknoswE2bsEJk4jR7UyTC/Uz4FM8y4WGzHHUmynNu0lCxdLXLUTYrcF0p DkmZ3BWFzvPWPdibajyFYyLXlw3IDN0+Ybjk7G58Yv0M99/1XK99plmnyDia0SEqUq30 yJd5sfFG9C8lE86MaiCxMpgB5L2wW4qcWhWpIRv1qge0DurxJDzjkdgDd/odCWRgAY5w bC2jloIlALpomtXmsSAEiO5Eiz3qlIIaFo1EQ7lNjGvYw9eWteVsXj8IKIccE0qSP2NU GQcw== 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=PgFdM2FTs1lf0bpLzUJZNIhpiElRhoQiMhPMtDnoZY1gWTT3SNmeVe8ogCbBTsk0QW F2+nrI76zQY2vq3w7/kqhk/FRcdmBKIiZN+ea33UDI37ebZ6nEWKFHEUAjWKrLnSrxr5 RPvXWfoh3cdOUcK5OF8D0vG6X4qVklAU6BhuXb2x3yXkvyzj8Xg97FR4T/VIqB1Q4tvd 9GkxwzIkZwuGVnL40O6sNmJBLy16zrca0AWs/d/LSTsnP3UbM4eqJiRZQo9IFxG02yGo YPc4pMXJGhWy7o7o8CBo6dJ+4zNAmMTCdCK8Qa+YqsnXqcl//2gBcbzDey67tx9R7kKE YBog== 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 c6si2277701qkb.164.2018.04.23.00.56.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 23 Apr 2018 00:56:52 -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]:51983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAWLE-000238-AA for patch@linaro.org; Mon, 23 Apr 2018 03:56:52 -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+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 Reviewed-by: Peter Maydell 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