From patchwork Thu Mar 22 14:38:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 132293 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp929579ljb; Thu, 22 Mar 2018 07:39:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELvoFO6ErS5vAh92OYVpwuCUlOzW+IvnDSHv565AiqcdZT/fCfOQ+3MdgNTv1iFSkebPTfOf X-Received: by 10.99.4.202 with SMTP id 193mr16040649pge.409.1521729555025; Thu, 22 Mar 2018 07:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521729555; cv=none; d=google.com; s=arc-20160816; b=Rnz44EglynzNVh8WR3wKAkoWwTr2xriKNnSVawmsAWZ6g2NXFaItNtxTeKs8w5SPiy LcSquNroqgGktweDwB5o2uUC/o44l/ZwyH8e/eW1NDJMpZ8ZPtX6qjtZ0tr6PSs9+hGi U902WSZmwYzO3t8Yaq9KRIY07AMf7XJ31E7YXYc19TKO8Mgtueb7zMhVCPcGN3Qacl6Q 3B/JCiMrcsiNwEsW0aDCZNX1PSTcMxfJyLC3xx98eJa/ZP3COTSChcynr8AFWv1vNjdB z2+yGOEmD4aUzMVqgaBs560wHtlxDgo0IB9nfBqI19iABeWAm5qslFrU22IAj/OoxvCM 8v+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature:arc-authentication-results; bh=Bd0pIwVSiL1w+PHZ9/ArgDx1G/ODsM+XDQES5TCAMJA=; b=jgnhkm9UFg/6ozQ4Tse/l57UYz8tPec4e7J+w+AXplmkBfXis1lw1ii1NfbnO9aLan BIR0zxa9ja1YKTDzhbSH1I0K/xNa2mKmpSHU2e+or7DAHSYGDvTVDmxBrxO6yAhXddO1 JxBoqh3BxYjHE6cOYEkmizVjgcAhu2k3PDfL8B388+lOwNBOa5Wg+EiMnLw9MWUJlcr+ yWFDja4gc6IocQW6MFiHQf1dTnbJYkyEWl6eIJWGwYHMXv6je31rZX/syY+FZD4YByzr gCX6O7+amrHIWUllllmMt5h4C5ihAwUM6sRSZXR5rgE6ASpKbTDnyaJ8OLJwrVPenKgA dzJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=OSKZrE8T; spf=pass (google.com: domain of binutils-return-101079-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-101079-patch=linaro.org@sourceware.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id s63si1696533pfk.354.2018.03.22.07.39.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 07:39:15 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-101079-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=OSKZrE8T; spf=pass (google.com: domain of binutils-return-101079-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-101079-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=VmV HNDkQmFygXzE8bXt9tqaIxApIilW3dpa/XQPGPyrAQl77WXWhfvU372h5n9OepXU AInQ2p6Uyx6K1KsNRML5QXceZQ1Qhw2l3hdiiOQyxfUpoSlZ5GZv4xZJu0oZw0ew 2FBeq/+1+Yi2gEVa5nys/SzbLlbGqrtTOqRXE2TE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=DiUIZJQC5 EbL5z63u8LDuf7VRUU=; b=OSKZrE8T4xWx9j6+9050yv950/pTPD9iOEpmgUENR QSJKbtXXGmgvunONvKiJlzLkeJyXqwQvoYxdg1UM3XOvvkNps5JRkC4QfDi+qwJD TulF3xmBlkZUSN+J60thersWeX6Hv/OKK/nScFSNuMw5XiWbi9P05lFp7nE5RFis jQ= Received: (qmail 31421 invoked by alias); 22 Mar 2018 14:39:02 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 31407 invoked by uid 89); 22 Mar 2018 14:39:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=BAYES_00, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=September, september, holding, designated X-HELO: mx07-00178001.pphosted.com Received: from mx08-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (91.207.212.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Mar 2018 14:38:58 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w2MESrg9024100 for ; Thu, 22 Mar 2018 15:38:56 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2gv69ptjv0-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 22 Mar 2018 15:38:56 +0100 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 6DCBE31 for ; Thu, 22 Mar 2018 14:38:55 +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 F30A32AFC for ; Thu, 22 Mar 2018 14:38:54 +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; Thu, 22 Mar 2018 15:38:54 +0100 From: Christophe Lyon To: Subject: [ARM-FDPIC 00/12] FDPIC ABI for ARM Date: Thu, 22 Mar 2018 15:38:18 +0100 Message-ID: <20180322143850.1766-1-christophe.lyon@st.com> MIME-Version: 1.0 X-ClientProxiedBy: SFHDAG4NODE1.st.com (10.75.127.10) To SFHDAG5NODE1.st.com (10.75.127.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-22_07:, , signatures=0 X-IsSubscribed: yes Hello, This patch series implements the binutils contribution of the FDPIC ABI for ARM targets. As such, it is mainly a linker development, with small additions to the assembler and other binary utilities. 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], and the intended target name is arm-linux-uclibceabi, although arm-linux-gnueabi works too. Note that arm-uclinux exists, but uses another ABI and the BFLAT file format; it does not support code sharing. 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 binutils from 2018-03-14, and is also available from my git branch (users/clyon/arm-fdpic on sourceware) [4]. 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 [5]. To build such a toolchain, you'd also need to use my uClibc branch [6]. In order to execute programs, you'd also need to use this qemu branch [7]. I am currently working on updating the patches for the other toolchain components, and will upstream them soon. This includes gcc, uclibc, gdb and qemu. This series provides support for ARM v7 and later architectures and has been tested on arm-linux-gnueabi without regression, as well as arm-linux-uclibceabi. Are the binutils 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://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=shortlog;h=refs/heads/users/clyon/arm-fdpic [5] https://git.linaro.org/people/christophe.lyon/gcc.git/log/?h=fdpic-upstream [6] https://git.linaro.org/people/christophe.lyon/uclibc.git/log/?h=uClibc-0.9.33.2-fdpic-upstream [7] https://git.linaro.org/people/christophe.lyon/qemu.git/log/?h=qemu-2.8.0-fdpic-upstream Christophe Lyon (12): [ARM] Add armelf_linux_fdpiceabi and armelfb_linux_fdpiceabi BFD backends [ARM] Add FDPIC OSABI flag support. [ARM] Add FDPIC relocations definitions [ARM] Implement FDPIC relocations. [ARM] Implement PLT for FDPIC. [ARM] Add TLS relocations for FDPIC. [ARM] FDPIC: Add stack segment [ARM] FDPIC: Translate R_ARM_TARGET2 relocation into R_ARM_GOT32 relocation for FDPIC platform [ARM] FDPIC: Make _GLOBAL_OFFSET_TABLE_ a relative symbol [ARM] FDPIC: Fix ld testcase not to conflict with uclibc's includes. [ARM] FDPIC: New tests. [ARM] FDPIC: Implement Thumb-only PLT for FDPIC. bfd/bfd-in2.h | 9 + bfd/config.bfd | 4 +- bfd/configure | 2 + bfd/configure.ac | 2 + bfd/elf32-arm.c | 1123 ++++++++++++++++++++++++++++-- bfd/reloc.c | 17 + bfd/targets.c | 4 + binutils/readelf.c | 7 + gas/config/tc-arm.c | 85 ++- gas/testsuite/gas/arm/reloc-fdpic.d | 20 + gas/testsuite/gas/arm/reloc-fdpic.s | 9 + include/elf/arm.h | 7 + include/elf/common.h | 1 + ld/Makefile.am | 13 + ld/Makefile.in | 15 + ld/configure.tgt | 4 +- ld/emulparams/armelf_linux_fdpiceabi.sh | 17 + ld/emulparams/armelfb_linux_fdpiceabi.sh | 2 + ld/scripttempl/elf.sc | 6 +- ld/testsuite/ld-arm/arm-elf.exp | 37 + ld/testsuite/ld-arm/fdpic-main-m.d | 73 ++ ld/testsuite/ld-arm/fdpic-main-m.s | 86 +++ ld/testsuite/ld-arm/fdpic-main-m.sym | 14 + ld/testsuite/ld-arm/fdpic-main.d | 72 ++ ld/testsuite/ld-arm/fdpic-main.ld | 244 +++++++ ld/testsuite/ld-arm/fdpic-main.r | 11 + ld/testsuite/ld-arm/fdpic-main.s | 86 +++ ld/testsuite/ld-arm/fdpic-main.sym | 14 + ld/testsuite/ld-arm/fdpic-shared-m.d | 37 + ld/testsuite/ld-arm/fdpic-shared-m.s | 52 ++ ld/testsuite/ld-arm/fdpic-shared-m.sym | 15 + ld/testsuite/ld-arm/fdpic-shared.d | 35 + ld/testsuite/ld-arm/fdpic-shared.ld | 228 ++++++ ld/testsuite/ld-arm/fdpic-shared.r | 8 + ld/testsuite/ld-arm/fdpic-shared.s | 52 ++ ld/testsuite/ld-arm/fdpic-shared.sym | 15 + ld/testsuite/ld-elf/pr2404b.c | 8 +- 37 files changed, 2364 insertions(+), 70 deletions(-) create mode 100644 gas/testsuite/gas/arm/reloc-fdpic.d create mode 100644 gas/testsuite/gas/arm/reloc-fdpic.s create mode 100644 ld/emulparams/armelf_linux_fdpiceabi.sh create mode 100644 ld/emulparams/armelfb_linux_fdpiceabi.sh create mode 100644 ld/testsuite/ld-arm/fdpic-main-m.d create mode 100644 ld/testsuite/ld-arm/fdpic-main-m.s create mode 100644 ld/testsuite/ld-arm/fdpic-main-m.sym create mode 100644 ld/testsuite/ld-arm/fdpic-main.d create mode 100644 ld/testsuite/ld-arm/fdpic-main.ld create mode 100644 ld/testsuite/ld-arm/fdpic-main.r create mode 100644 ld/testsuite/ld-arm/fdpic-main.s create mode 100644 ld/testsuite/ld-arm/fdpic-main.sym create mode 100644 ld/testsuite/ld-arm/fdpic-shared-m.d create mode 100644 ld/testsuite/ld-arm/fdpic-shared-m.s create mode 100644 ld/testsuite/ld-arm/fdpic-shared-m.sym create mode 100644 ld/testsuite/ld-arm/fdpic-shared.d create mode 100644 ld/testsuite/ld-arm/fdpic-shared.ld create mode 100644 ld/testsuite/ld-arm/fdpic-shared.r create mode 100644 ld/testsuite/ld-arm/fdpic-shared.s create mode 100644 ld/testsuite/ld-arm/fdpic-shared.sym -- 2.6.3