From patchwork Mon Apr 30 08:03:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 134694 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3482336lji; Mon, 30 Apr 2018 01:07:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqgrSzY4c7GzurpvOZ8sngDYQO30/e/HEstdRYjz3SjtFaizZq+j+UZPj5EriVY8HwNe2u6 X-Received: by 2002:a0c:8464:: with SMTP id l91-v6mr10532452qva.15.1525075664466; Mon, 30 Apr 2018 01:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525075664; cv=none; d=google.com; s=arc-20160816; b=z6vdGrUfoG0P4R59EDlvAf5VLaHniVNSdHb8+bl2utybiAGXnbQJwWlkjv/YQunWTe 50DnGUIPjFxtK2cFpCZl4Jl8WQME3yot2b8g5+2+ByTSay/XEN3puZUs5cAmiA69GxGz YKMj/6vzcyyLxAv/YWPTmWdmb6jdady6HoOmOYG0x+4INdIMIzSDxEQby87zF6QJIUVZ sc9ThHeYIcVCRZgLDK59Nz/c63Uq10VglRKyZSep04ekToZOMXw2U7PQXLw9YcsHg9Lw IsZEW01nVSjhU5wY2RbXEF7+MDs0rrz4kyf+LNzJDT++E7Hvnyz3ZWjVjXzb3S3MgB2D fcPg== 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=QsVLxD9wysG80D8HGrP3MfXASNjCAac8JK2KBM190kqg9oFoh2R5tZsYZ4p6d74MWR dvLWW/4rmSyX/sHzxHJb+FUmc5JqnBOfqxiMlag7PUU/XK2OEwXp8gzTNtAV3Eb6xenK hkHj8NzGfBgwWmao+0s9VEfrLrfo+6evXfDiDXt0rtY5Dc669KT2zdiZy0u175svuonI yBxzXtngle40XOVKrCzhOREyskEho4sVS4YT6fvWi/RzE2X8PpUUPStfVBjp5EY9m+Ui AdoWcp3TtV1AoXEseBD+B9qREAYIrI3QWtuExo2oe+s/MWysbCzkR3bEXnvC0ofvO58c mZPA== 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 o24-v6si922654qtc.387.2018.04.30.01.07.44 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 30 Apr 2018 01:07:44 -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]:58267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fD3qZ-00043d-VY for patch@linaro.org; Mon, 30 Apr 2018 04:07:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fD3ny-0002v3-5h for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:05:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fD3nv-0002SN-1k for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:05:02 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:37644 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 1fD3nu-0002S6-NE for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:04:58 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3U84RJ2026202; Mon, 30 Apr 2018 10:04:55 +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 2hmfufytmn-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 30 Apr 2018 10:04:55 +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 AB83231; Mon, 30 Apr 2018 08:04:54 +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 94231252D; Mon, 30 Apr 2018 08:04:54 +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:53 +0200 From: Christophe Lyon To: , , , , Date: Mon, 30 Apr 2018 10:03:42 +0200 Message-ID: <20180430080404.7323-3-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-MIME-Autoconverted: from 8bit to quoted-printable by mx08-.pphosted.com id w3U84RJ2026202 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 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 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) {