From patchwork Fri Apr 6 15:17:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 132924 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp914489ljb; Fri, 6 Apr 2018 08:19:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49NJ2h0p2d5jfiUwwFBkZ4UwOJn08kLLu4Cw+Jqpx+7xInGJ3N32VsjyFkI8FIfrB3qPqBn X-Received: by 10.55.215.139 with SMTP id t11mr35753618qkt.90.1523027940151; Fri, 06 Apr 2018 08:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523027940; cv=none; d=google.com; s=arc-20160816; b=z3lSFUwjCn3aWMMmEVJSajyaHHXyqsSo34GsciHOeTOeufczHhGJGgbguEc/3MuflN M6nJAvS20vQYd1fNXPqJWlvMmRsLlEyVbkohRuaWx5wv8NP5ahC+b1QwT3WXdXgQiiaf xt5lLW/o8cOxICbWnPxeKQBqPWMO0W4BQW7D5BWqb6hZk6XfBJLOMLEASgQ+Jt7EIAUy lizaMTMUd77j5uqZZf9AGsTZY/zryMkt0t/5J62rL8WrMz+zg8//ppS2ueziDMM26Yjo ffiOgSMu7cGuBftYW5e22AveUivWR5WW8VHNyy4VsOUOzdCNvAVZOWkbe9Q/T5wRiXNn PVgg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=scXtL4E7tbkr5vR7eDGV4KBNJrsgFpvLkvJcPS0x02c=; b=kfQ1wOjutm1151jUixldQkkNficIzEq4n8dcM9jn5l3O0RRfx3Np9CQ+g1VjxUx/W9 IJt5jFChCueuxAKrOD4T/7QDYLsTz9Uef1F1fL/8oN+Ly+Fe0WQ5UEaGbmDg8t3OiGZk 7I2GBfyT5Yl/Vl+6Wyiy/Xk+pUfKqN1c6VfAfcHbp46rJFnbKNqH453mXwk2zfjsFdSu naT4eXxGM21zC4ulP7IzSI2MyRRUNfvazGXHn3EAV1u7AYylEffQ/1s9sMLVTvQgYfHd 5CYrp8ZC4gD7OIiHNnyfxQcMlLrcGXvC05h3K44hQJ3EsaTj5VvT1s5FAyQiaZg/XNhl CLew== 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 j35si11929053qkh.66.2018.04.06.08.18.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 06 Apr 2018 08:19:00 -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]:33931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4T8l-0003q3-I1 for patch@linaro.org; Fri, 06 Apr 2018 11:18:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4T8C-0003mj-Ah for qemu-devel@nongnu.org; Fri, 06 Apr 2018 11:18:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4T89-0004V2-3R for qemu-devel@nongnu.org; Fri, 06 Apr 2018 11:18:24 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:43962) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f4T88-0004Ua-PW for qemu-devel@nongnu.org; Fri, 06 Apr 2018 11:18:21 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w36FE8aN020618; Fri, 6 Apr 2018 17:18:19 +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 2h1ysxp456-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 06 Apr 2018 17:18:19 +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 CCB2B3D; Fri, 6 Apr 2018 15:18:18 +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 9410CA6DF; Fri, 6 Apr 2018 15:18:18 +0000 (GMT) Received: from gnx2104.gnb.st.com (10.75.127.51) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 6 Apr 2018 17:18:18 +0200 From: Christophe Lyon To: , , Date: Fri, 6 Apr 2018 17:17:29 +0200 Message-ID: <20180406151752.10854-2-christophe.lyon@st.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180406151752.10854-1-christophe.lyon@st.com> References: <20180406151752.10854-1-christophe.lyon@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG6NODE1.st.com (10.75.127.16) To SFHDAG5NODE1.st.com (10.75.127.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-06_08:, , signatures=0 X-MIME-Autoconverted: from 8bit to quoted-printable by mx07-.pphosted.com id w36FE8aN020618 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 1/4] linux-user: ARM-FDPIC: Add configure option to support loading of FDPIC binaries 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" Adds --enable-fdpic and --disable-fdpic configure options. This feature is disabled by default, that's why it is not described in the "Optional features" help section (which are enabled by default if possible). FDPIC ELF objects are identified with e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC. Co-Authored-By: Mickaël Guêné Signed-off-by: Christophe Lyon -- 2.6.3 diff --git a/configure b/configure index 4d0e92c..af4c14b 100755 --- a/configure +++ b/configure @@ -451,6 +451,7 @@ jemalloc="no" replication="yes" vxhs="" libxml2="" +fdpic="no" supported_cpu="no" supported_os="no" @@ -1374,6 +1375,10 @@ for opt do ;; --disable-git-update) git_update=no ;; + --disable-fdpic) fdpic="no" + ;; + --enable-fdpic) fdpic="yes" + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1544,6 +1549,8 @@ Advanced options (experts only): xen pv domain builder --enable-debug-stack-usage track the maximum stack usage of stacks created by qemu_alloc_stack + --disable-fdpic disable loading of FDPIC binary (default) + --enable-fdpic enable loading of FDPIC binary Optional features, enabled with --enable-FEATURE and disabled with --disable-FEATURE, default is enabled if available: @@ -7085,6 +7092,9 @@ fi echo "LDFLAGS+=$ldflags" >> $config_target_mak echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak +if [ "$fdpic" = "yes" ]; then + echo "CONFIG_USE_FDPIC=y" >> $config_target_mak +fi done # for target in $targets diff --git a/include/elf.h b/include/elf.h index c0dc9bb..934dbbd 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1483,6 +1483,7 @@ typedef struct elf64_shdr { #define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ #define ELFOSABI_MODESTO 11 /* Novell Modesto. */ #define ELFOSABI_OPENBSD 12 /* OpenBSD. */ +#define ELFOSABI_ARM_FDPIC 65 /* ARM FDPIC */ #define ELFOSABI_ARM 97 /* ARM */ #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 23e3495..7ba3795 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1658,6 +1658,14 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot) } #ifdef CONFIG_USE_FDPIC + +#ifdef TARGET_ARM +static int elf_is_fdpic(struct elfhdr *exec) +{ + return exec->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC; +} +#endif + static abi_ulong loader_build_fdpic_loadmap(struct image_info *info, abi_ulong sp) { uint16_t n;