[v2,3/9] arch: make FDPIC dependent on toolchain support

Message ID 20240922092312.2061358-4-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>

FDPIC support on ARM requires a certain target name, and therefore is
only currently available with the Buildroot toolchain. In addition,
only uClibc-ng supports FDPIC on ARM at the moment.

This may need to become more complicated if we end up in a situation
where each libc supports FDPIC on a different set of architectures.

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 +
 toolchain/Config.in | 4 ++++
 2 files changed, 5 insertions(+)

Comments

'Krzysztof Kozlowski' via Amarula Linux Sept. 22, 2024, 10:06 a.m. UTC | #1
Hello Dario,

Thanks for reposting this patch series after our discussion last
week-end!

On Sun, 22 Sep 2024 11:23:06 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> From: Ben Wolsieffer <ben.wolsieffer@hefring.com>
> 
> FDPIC support on ARM requires a certain target name, and therefore is
> only currently available with the Buildroot toolchain. In addition,
> only uClibc-ng supports FDPIC on ARM at the moment.
> 
> This may need to become more complicated if we end up in a situation
> where each libc supports FDPIC on a different set of architectures.

However, I think this patch is incorrect, or more precisely it's not
how we want to handle things. Instead, what we want is:

- For internal toolchains, that C libraries that don't support FDPIC
  are made unavailable when FDPIC is selected. So basically I would add
  a depends on BR2_BINFMT_ELF to BR2_PACKAGE_GLIBC_ARCH_SUPPORTS and
  BR2_PACKAGE_MUSL_ARCH_SUPPORTS. In practice this will be a no-op as
  glibc and musl already have a "depends on BR2_USE_MMU", and FDPIC can
  only be selected on noMMU systems.

- For external toolchains, I would make sure that the ARM toolchains
  properly depend on the relevant BR2_BINFMT_* option.

Best regards,

Thomas

Patch

diff --git a/arch/Config.in b/arch/Config.in
index e57f4b2baa06..52efe3aabda1 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -447,6 +447,7 @@  config BR2_BINFMT_ELF
 config BR2_BINFMT_FDPIC
 	bool "FDPIC"
 	depends on BR2_ARCH_HAS_FDPIC_SUPPORT
+	depends on BR2_TOOLCHAIN_SUPPORTS_FDPIC
 	select BR2_BINFMT_SUPPORTS_SHARED
 	help
 	  ELF FDPIC binaries are based on ELF, but allow the individual
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 6e91ab756cd4..0dd4bb5d9b8e 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -48,6 +48,7 @@  choice
 config BR2_TOOLCHAIN_BUILDROOT
 	bool "Buildroot toolchain"
 	depends on BR2_ARCH_HAS_TOOLCHAIN_BUILDROOT
+	select BR2_TOOLCHAIN_SUPPORTS_FDPIC if BR2_TOOLCHAIN_USES_UCLIBC
 
 config BR2_TOOLCHAIN_EXTERNAL
 	bool "External toolchain"
@@ -307,6 +308,9 @@  config BR2_TOOLCHAIN_HAS_OPENMP
 config BR2_TOOLCHAIN_SUPPORTS_PIE
 	bool
 
+config BR2_TOOLCHAIN_SUPPORTS_FDPIC
+	bool
+
 config BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY
 	bool "Copy gconv libraries"
 	depends on BR2_TOOLCHAIN_USES_GLIBC