From patchwork Mon Apr 30 08:03:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 134692 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3481782lji; Mon, 30 Apr 2018 01:07:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZreGBZPP6G1kJLR/ZjqkAAPMttJCmLknDNdix9IHgQgD2v/wmGMK4vXD8E2f+CdzuCYR/Gk X-Received: by 2002:ac8:2d6e:: with SMTP id o43-v6mr10271616qta.316.1525075622211; Mon, 30 Apr 2018 01:07:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525075622; cv=none; d=google.com; s=arc-20160816; b=pK1//M7YhTZzdu4ArrRyWmqV/PlxJf6YDWZG8bD5PpTNqiZrcEHgGy4IxxCLQ3uHiI TuVN4Ls7qIMyxXbq49ZfOfMFWaFcFFZNS3JK46Q9vBRt9o2fF8UgffZOMU8OyrrddGJS /2OxpsrMRCe95YXSgFznoJcOEXAlBVDjbBLD6a8+qbdC9V0I/gurdrJGGS1PjXWNfQTe UTC1So4DeNzUVg6zWxvyLYL2CK9yfXr2K0CGs1iA2rkJzGnDSdc1PpR/ZrjUiWY8aU6e cN5nrnc1fdY0g08GL9c0WnNvUmtrFw12Zq/Ef9IRH3eUdSdB56N39nUtIPSNOzH5g32a Hcrw== 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:message-id:date:to:from :arc-authentication-results; bh=2shlccwVMufpLmYCmI24eMxz0TDILGMO8Svypq6vapg=; b=scDv7XbVFaGYnqwEMGF6KHLBZjQjAxuUs8xUUaFANWxsmxwZNmleCv9mvTAETXeZQr rGq0KawaT4S4MVTkfW9ndfrUHYLAr2dR57FiVS1xBGZM3Dx555IwOaZdtDnNW7WWueO1 JqvOH4A5VE97z9G8fxfk8d6gLIys62zkoOHPYiyA7dYINuzV7iGky4prGpOQ/v5Zbg7M SWyypwjmbwTTADUVkHiyHJLTqDktF2TqMNi+5Q2VAoje3ccKIziyZjcQRiRpcc9uYdO2 3L1IvKjSGeqNtrFSiTeweWxuW41HtvjzhBtIJqzn7t9FCIiGlmtlicsyi+iUghDaO1qG WZDQ== 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 44-v6si2053933qte.366.2018.04.30.01.07.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 30 Apr 2018 01:07:02 -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]:58264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fD3pt-0003Md-JO for patch@linaro.org; Mon, 30 Apr 2018 04:07:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fD3nU-0002gi-9R for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:04:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fD3nR-0002LC-5X for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:04:32 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:37598 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 1fD3nQ-0002IL-T9 for qemu-devel@nongnu.org; Mon, 30 Apr 2018 04:04:29 -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 w3U7xiSN023243; Mon, 30 Apr 2018 10:04:15 +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 2hmfufythk-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 30 Apr 2018 10:04:15 +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 50B9C38; Mon, 30 Apr 2018 08:04:14 +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 0CFAA2551; Mon, 30 Apr 2018 08:04:13 +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:13 +0200 From: Christophe Lyon To: , , , , Date: Mon, 30 Apr 2018 10:03:40 +0200 Message-ID: <20180430080404.7323-1-christophe.lyon@st.com> X-Mailer: git-send-email 2.9.5 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 0/4] FDPIC ABI for ARM 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" Hello, This patch series implements the QEMU contribution of the FDPIC ABI for ARM targets. This ABI enables to run Linux on ARM MMU-less cores and supports shared libraries to reduce the memory footprint. Without MMU, text and data segment relative distances are different from one process to another, hence the need for a dedicated FDPIC register holding the start address of the data segment. One of the side effects is that function pointers require two words to be represented: the address of the code, and the data segment start address. These two words are designated as "Function Descriptor", hence the "FD PIC" name. On ARM, the FDPIC register is r9 [3]. This work was developed some time ago by STMicroelectronics, and was presented during Linaro Connect SFO15 (September 2015). You can watch the discussion and read the slides [1]. This presentation was related to the toolchain published on github [2], which is based on binutils-2.22, gcc-4.7, uclibc-0.9.33.2, gdb-7.5.1 and qemu-2.3.0, and for which pre-built binaries are available [2]. The ABI itself is described in details in [3]. Our Linux kernel patches have been updated and committed by Nicolas Pitre (Linaro) in July 2017. They are required so that the loader is able to handle this new file type. Indeed, the ELF files are tagged with ELFOSABI_ARM_FDPIC. This new tag has been allocated by ARM, as well as the new relocations involved. This patch series has been rebased on top of QEMU from 2018-03-28. I have also rebased the GCC patch series, but it is still WIP as cleanup is still needed before I can request a review. It can be useful to build a preview toolchain though, so my WIP branch is available at [4]. To build such a toolchain, you'd also need to use my uClibc branch [5]. I am currently working on updating the patches for the other toolchain components, and will upstream them soon. This includes gcc, uclibc, and gdb. This series provides support for ARM v7 and later architectures and has been used to run the GCC tests on arm-linux-gnueabi without regression, as well as arm-linux-uclibceabi. v3->v4: - Fix nits in patch #3. v2->v3: - Do not add the is_fdpic field to TaskState, as the information can be retrieved from the 'info' data in TaskState. - Setup_return() now returns an error if the FDPIC function description isn't readable. Callers of setup_return() are updated to force_sigsegv in such cases. v1->v2: - Patch #1 removes CONFIG_USE_FDPIC - Patch #2 corresponds to the previous patch #1, and is now simpler without configure option - Patch #3 corresponds to the previous patch #2, and uses TaskState instead of CPUARMState - patch #4 corresponds to the previous patch #3, and fixes guest pointer dereferencing Are the QEMU patches OK for inclusion in master? Thanks, Christophe. [1] http://connect.linaro.org/resource/sfo15/sfo15-406-arm-fdpic-toolset-kernel-libraries-for-cortex-m-cortex-r-mmuless-cores/ [2] https://github.com/mickael-guene/fdpic_manifest [3] https://github.com/mickael-guene/fdpic_doc/blob/master/abi.txt [4] https://git.linaro.org/people/christophe.lyon/gcc.git/log/?h=fdpic-upstream [5] https://git.linaro.org/people/christophe.lyon/uclibc.git/log/?h=uClibc-0.9.33.2-fdpic-upstream Christophe Lyon (4): Remove CONFIG_USE_FDPIC. linux-user: ARM-FDPIC: Identify ARM FDPIC binaries linux-user: ARM-FDPIC: Add support of FDPIC for ARM. linux-user: ARM-FDPIC: Add support for signals for FDPIC targets include/elf.h | 1 + linux-user/elfload.c | 54 ++++++++++++++++++++------ linux-user/qemu.h | 13 ++++++- linux-user/signal.c | 105 +++++++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 144 insertions(+), 29 deletions(-) -- 2.6.3 Reviewed-by: Peter Maydell