[ARM-FDPIC 00/12] FDPIC ABI for ARM

Christophe Lyon christophe.lyon@st.com
Thu Mar 22 14:39:00 GMT 2018


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



More information about the Binutils mailing list