[v2,4/9] arch/arm: add support for FDPIC

Message ID 20240922092312.2061358-5-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • add ARM FDPIC support
Related show

Commit Message

Dario Binacchi Sept. 22, 2024, 9:23 a.m. UTC
From: Ben Wolsieffer <ben.wolsieffer@hefring.com>

Linux on ARM supports FDPIC binaries intended for use on no-MMU systems.
This patch enables support for building a toolchain that produces FDPIC
binaries.

The target name for a FDPIC toolchain must be
arm-<vendor>-uclinuxfdpiceabi, which doesn't follow the standard format
and requires a special case.

According to the kernel help for CONFIG_BINFMT_ELF_FDPIC, "It is also
possible to run FDPIC ELF binaries on MMU linux," so FDPIC support is
available on all ARM platforms, not just no-MMU.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
No changes since v1

 arch/Config.in      | 1 +
 package/Makefile.in | 6 ++++++
 2 files changed, 7 insertions(+)

Comments

'Krzysztof Kozlowski' via Amarula Linux Sept. 22, 2024, 10:08 a.m. UTC | #1
On Sun, 22 Sep 2024 11:23:07 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> The target name for a FDPIC toolchain must be
> arm-<vendor>-uclinuxfdpiceabi, which doesn't follow the standard format
> and requires a special case.
> 
> According to the kernel help for CONFIG_BINFMT_ELF_FDPIC, "It is also
> possible to run FDPIC ELF binaries on MMU linux," so FDPIC support is
> available on all ARM platforms, not just no-MMU.

but then I guess the tuple would not be arm-<vendor>-uclinuxfdpiceabi,
but something with "linux" instead? Did you test this support for FDPIC
on MMU systems? Unless it has been tested to be working, I believe I
would prefer to allow FDPIC only on noMMU systems, for which it has
been tested.

Thanks!

Thomas

Patch

diff --git a/arch/Config.in b/arch/Config.in
index 52efe3aabda1..cd258b2530d8 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -39,6 +39,7 @@  config BR2_arceb
 
 config BR2_arm
 	bool "ARM (little endian)"
+	select BR2_ARCH_HAS_FDPIC_SUPPORT
 	# MMU support is set by the subarchitecture file, arch/Config.in.arm
 	help
 	  ARM is a 32-bit reduced instruction set computer (RISC)
diff --git a/package/Makefile.in b/package/Makefile.in
index 808b71a93e99..829636900ba9 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -39,7 +39,13 @@  $(error BR2_TOOLCHAIN_BUILDROOT_VENDOR cannot be 'unknown'. \
 endif
 
 # Compute GNU_TARGET_NAME
+# FDPIC on ARM requires a special target name: it has no OS field and must
+# use the suffix -uclinuxfdpiceabi.
+ifeq ($(BR2_arm)$(BR2_armeb):$(BR2_BINFMT_FDPIC),y:y)
+GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-uclinuxfdpiceabi
+else
 GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI)
+endif
 
 # FLAT binary format needs uclinux, except RISC-V which needs the
 # regular linux name.