From patchwork Mon Apr 23 07:51:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 133974 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp701340lji; Mon, 23 Apr 2018 00:58:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrQaDhja10z9c5qxvffwz/xAMK1uGv1GDJkySUt3a7i0HjnqU7ikiLkrf9agDpDbrt92D+k X-Received: by 10.55.57.134 with SMTP id g128mr21289482qka.369.1524470295826; Mon, 23 Apr 2018 00:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524470295; cv=none; d=google.com; s=arc-20160816; b=z7dgNZnsBsEtWiMVQULbVJBarj+CJhS2TVfgYLTFowDGm27jG5YCGrIKOEU+2TbxLZ WwblJ2H9fEvRr4QeX8qbd1WWaEhuSo2tEWe97lGMpPOzMiXKtAHxOuZrJxBq8FmhhBdS X+isA2ihNg2Mt2iF1so8UDai7DaGNQu9K8TpDMvmRM+AaRl5CEnWYRnhgfViRwgwdg2R s7DkgpSEFS+KGSP+GBlTmtAeMXL7s/DinrSb+CTeBRLTcYEsw6Ljn6n4WoN9KTJzmRYm fN4DdG6izL3aWAR8PmvvKNKlxHZBjFuRQ0LjBM6qSBHOMWauE9vjFgWH8AOwn0bOPfOB zYiA== 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=6KrPELbn9ochoMczgYbSqG0jAtnKiYLepoONM2OyDIQ=; b=bncTRpowA60JrVgWA6zY6Y04Kc1Ri3ZkEaYFwmUURwLl3dkxfha+/Qr5XEFHQ1BtZD 8glNE4bQQFwszTYE9ohkuKwcC+REJnQMIaqHGVzehUX6N1NeBY4D0P8QOQwTYUurBNVb QjJRXZjtXK/HA4C6CdJTVT/xRjWN97YN77LfIHT59y9PD4y7YDXCeCOD45YdqvOJ8UkL nZ81t9uO8OqGymPIKit6e8WzAp7iFFSFf0V+m3ZjaCtms2A+F/XZKg3pMZPvd4auYpOS I4HCxWUGL4K8OwwMjyoOfOicIIGihyX2M6981caY0Je9mVHsFMMj12fvsKObK6Yxy3oY I0TA== 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 e64si8112910qkh.332.2018.04.23.00.58.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 23 Apr 2018 00:58:15 -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]:52131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAWMZ-0003Js-BJ for patch@linaro.org; Mon, 23 Apr 2018 03:58:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAWHd-0000A8-Ei for qemu-devel@nongnu.org; Mon, 23 Apr 2018 03:53:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAWHa-0000IN-BQ for qemu-devel@nongnu.org; Mon, 23 Apr 2018 03:53:09 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:20030) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fAWHa-0000Hv-1A for qemu-devel@nongnu.org; Mon, 23 Apr 2018 03:53:06 -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 w3N7nUcp027825; Mon, 23 Apr 2018 09:53:01 +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 2hfu2tsgw6-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 23 Apr 2018 09:53:01 +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 A6C3F38; Mon, 23 Apr 2018 07:53:00 +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 4C342118E; Mon, 23 Apr 2018 07:53:00 +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:59 +0200 From: Christophe Lyon To: , , , , Date: Mon, 23 Apr 2018 09:51:53 +0200 Message-ID: <20180423075215.4572-3-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-MIME-Autoconverted: from 8bit to quoted-printable by mx07-.pphosted.com id w3N7nUcp027825 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 2/4] linux-user: ARM-FDPIC: Identify ARM 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" Define an ARM-specific version of elf_is_fdpic: 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 Reviewed-by: Peter Maydell 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 bbe93b0..76d7718 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1681,11 +1681,18 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot) } } +#ifdef TARGET_ARM +static int elf_is_fdpic(struct elfhdr *exec) +{ + return exec->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC; +} +#else /* Default implementation, always false. */ static int elf_is_fdpic(struct elfhdr *exec) { return 0; } +#endif static abi_ulong loader_build_fdpic_loadmap(struct image_info *info, abi_ulong sp) {