Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM
@ 2022-08-19 15:17 Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 1/8] Revert "arch: drop now useless support for FDPIC" Ben Wolsieffer
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

Introduce support for the FDPIC binary format on ARM. FDPIC binaries
enable memory sharing between processes on no-MMU systems.

Changes in v3:
  * Don't change default binary format
  * Disable FDPIC support with external toolchains
  * Enable NPTL if FDPIC is used
  * Patch libtool to support ARM FDPIC shared libraries

Changes in v2:
  * Simplify special casing of FDPIC toolchain target
  * Add additional patches to fix building Linux and U-Boot with an
    FDPIC toolchain by passing -mno-fdpic. I have submitted fixes
    upstream to do this automatically, but they have not yet been
    accepted and will take a while to end up in Buildroot.

Cc: Vladimir Murzin <vladimir.murzin@arm.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>

Ben Wolsieffer (8):
  Revert "arch: drop now useless support for FDPIC"
  arch: don't enable FDPIC binaries by default
  arch: make FDPIC dependent on toolchain support
  arch/arm: add support for FDPIC
  boot/uboot: pass -mno-fdpic if FDPIC is enabled
  linux: pass -mno-fdpic if FDPIC is enabled
  package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
  package/pkg-autotools: patch libtool to support ARM FDPIC

 arch/Config.in           | 15 +++++++++++++++
 boot/uboot/uboot.mk      |  5 +++++
 linux/linux.mk           |  8 +++++++-
 package/Makefile.in      |  6 ++++++
 package/pkg-autotools.mk | 17 +++++++++++++++++
 package/uclibc/Config.in |  2 +-
 package/uclibc/uclibc.mk |  8 ++++++++
 toolchain/Config.in      |  4 ++++
 8 files changed, 63 insertions(+), 2 deletions(-)

-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [PATCH v3 1/8] Revert "arch: drop now useless support for FDPIC"
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
@ 2022-08-19 15:17 ` Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 2/8] arch: don't enable FDPIC binaries by default Ben Wolsieffer
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

This reverts commit 58dcd28dfbed481becb822b009583a63efbc6ffa.

ARM supports FDPIC, so this code is needed once again.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
---
 arch/Config.in           | 14 ++++++++++++++
 package/uclibc/uclibc.mk |  8 ++++++++
 2 files changed, 22 insertions(+)

diff --git a/arch/Config.in b/arch/Config.in
index 1c0c400a98..c5d481b9e5 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -12,6 +12,9 @@ config BR2_SOFT_FLOAT
 config BR2_USE_MMU
 	bool
 
+config BR2_ARCH_HAS_FDPIC_SUPPORT
+	bool
+
 choice
 	prompt "Target Architecture"
 	default BR2_i386
@@ -418,6 +421,7 @@ endif
 choice
 	prompt "Target Binary Format"
 	default BR2_BINFMT_ELF if BR2_USE_MMU
+	default BR2_BINFMT_FDPIC if BR2_ARCH_HAS_FDPIC_SUPPORT
 	default BR2_BINFMT_FLAT
 
 config BR2_BINFMT_ELF
@@ -429,6 +433,16 @@ config BR2_BINFMT_ELF
 	  and executables used across different architectures and
 	  operating systems.
 
+config BR2_BINFMT_FDPIC
+	bool "FDPIC"
+	depends on BR2_ARCH_HAS_FDPIC_SUPPORT
+	select BR2_BINFMT_SUPPORTS_SHARED
+	help
+	  ELF FDPIC binaries are based on ELF, but allow the individual
+	  load segments of a binary to be located in memory
+	  independently of each other. This makes this format ideal for
+	  use in environments where no MMU is available.
+
 config BR2_BINFMT_FLAT
 	bool "FLAT"
 	depends on !BR2_USE_MMU
diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index 0ddf7dfa6d..f7810e4974 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -56,6 +56,14 @@ UCLIBC_LOCALES = \
 endif
 
 # noMMU binary formats
+ifeq ($(BR2_BINFMT_FDPIC),y)
+define UCLIBC_BINFMT_CONFIG
+	$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FLAT,$(@D)/.config)
+	$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FLAT_SEP_DATA,$(@D)/.config)
+	$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_SHARED_FLAT,$(@D)/.config)
+	$(call KCONFIG_ENABLE_OPT,UCLIBC_FORMAT_FDPIC_ELF,$(@D)/.config)
+endef
+endif
 ifeq ($(BR2_BINFMT_FLAT_ONE),y)
 define UCLIBC_BINFMT_CONFIG
 	$(call KCONFIG_ENABLE_OPT,UCLIBC_FORMAT_FLAT)
-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [PATCH v3 2/8] arch: don't enable FDPIC binaries by default
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 1/8] Revert "arch: drop now useless support for FDPIC" Ben Wolsieffer
@ 2022-08-19 15:17 ` Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 3/8] arch: make FDPIC dependent on toolchain support Ben Wolsieffer
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

FDPIC support is being added as a new option for an existing
architecture (ARM), so we don't want to suddenly change the default.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
---
 arch/Config.in | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/Config.in b/arch/Config.in
index c5d481b9e5..0ee7077df6 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -421,7 +421,6 @@ endif
 choice
 	prompt "Target Binary Format"
 	default BR2_BINFMT_ELF if BR2_USE_MMU
-	default BR2_BINFMT_FDPIC if BR2_ARCH_HAS_FDPIC_SUPPORT
 	default BR2_BINFMT_FLAT
 
 config BR2_BINFMT_ELF
-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [PATCH v3 3/8] arch: make FDPIC dependent on toolchain support
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 1/8] Revert "arch: drop now useless support for FDPIC" Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 2/8] arch: don't enable FDPIC binaries by default Ben Wolsieffer
@ 2022-08-19 15:17 ` Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 4/8] arch/arm: add support for FDPIC Ben Wolsieffer
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

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

diff --git a/arch/Config.in b/arch/Config.in
index 0ee7077df6..4cd58041a4 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -435,6 +435,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 fbc2f28553..be72350c06 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -49,6 +49,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"
@@ -269,6 +270,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
-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [PATCH v3 4/8] arch/arm: add support for FDPIC
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
                   ` (2 preceding siblings ...)
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 3/8] arch: make FDPIC dependent on toolchain support Ben Wolsieffer
@ 2022-08-19 15:17 ` Ben Wolsieffer
  2023-04-16 16:22   ` Yann E. MORIN
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 5/8] boot/uboot: pass -mno-fdpic if FDPIC is enabled Ben Wolsieffer
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

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 an 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>
---
 arch/Config.in      | 1 +
 package/Makefile.in | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/arch/Config.in b/arch/Config.in
index 4cd58041a4..c639738f5f 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 ff60f85092..81a7028275 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -37,7 +37,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 64-bits which needs
 # the regular linux name.
-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [PATCH v3 5/8] boot/uboot: pass -mno-fdpic if FDPIC is enabled
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
                   ` (3 preceding siblings ...)
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 4/8] arch/arm: add support for FDPIC Ben Wolsieffer
@ 2022-08-19 15:17 ` Ben Wolsieffer
  2023-09-30 20:36   ` Thomas Petazzoni via buildroot
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 6/8] linux: " Ben Wolsieffer
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

If the FDPIC ABI is enabled by default in the toolchain, it must be
explicitly disabled when building U-Boot.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
---
 boot/uboot/uboot.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index a9f9b1bf16..4955a59a60 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -158,6 +158,11 @@ UBOOT_MAKE_OPTS += \
 	HOSTLDFLAGS="$(HOST_LDFLAGS)" \
 	$(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS))
 
+# Disable FDPIC if enabled by default in toolchain
+ifeq ($(BR2_BINFMT_FDPIC),y)
+UBOOT_MAKE_OPTS += KCFLAGS=-mno-fdpic
+endif
+
 ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y)
 UBOOT_DEPENDENCIES += arm-trusted-firmware
 ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y)
-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [PATCH v3 6/8] linux: pass -mno-fdpic if FDPIC is enabled
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
                   ` (4 preceding siblings ...)
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 5/8] boot/uboot: pass -mno-fdpic if FDPIC is enabled Ben Wolsieffer
@ 2022-08-19 15:17 ` Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 7/8] package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC Ben Wolsieffer
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

If the FDPIC ABI is enabled by default in the toolchain, it must be
explicitly disabled when building the kernel.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
---
 linux/linux.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/linux/linux.mk b/linux/linux.mk
index efdc21eff2..646f0e9b27 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -152,6 +152,7 @@ endif
 LINUX_MAKE_FLAGS = \
 	HOSTCC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS)" \
 	ARCH=$(KERNEL_ARCH) \
+	KCFLAGS="$(LINUX_CFLAGS)" \
 	INSTALL_MOD_PATH=$(TARGET_DIR) \
 	CROSS_COMPILE="$(TARGET_CROSS)" \
 	WERROR=0 \
@@ -172,7 +173,12 @@ endif
 # sanitize the arguments passed from user space in registers.
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435
 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
-LINUX_MAKE_ENV += KCFLAGS=-Wno-attribute-alias
+LINUX_CFLAGS += -Wno-attribute-alias
+endif
+
+# Disable FDPIC if enabled by default in toolchain
+ifeq ($(BR2_BINFMT_FDPIC),y)
+LINUX_CFLAGS += -mno-fdpic
 endif
 
 ifeq ($(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT),y)
-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [PATCH v3 7/8] package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
                   ` (5 preceding siblings ...)
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 6/8] linux: " Ben Wolsieffer
@ 2022-08-19 15:17 ` Ben Wolsieffer
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 8/8] package/pkg-autotools: patch libtool to support ARM FDPIC Ben Wolsieffer
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

NPTL is supported on no-MMU ARM systems if FDPIC binaries are used.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
---
 package/uclibc/Config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/uclibc/Config.in b/package/uclibc/Config.in
index 2555487f06..4ac47df579 100644
--- a/package/uclibc/Config.in
+++ b/package/uclibc/Config.in
@@ -76,7 +76,7 @@ choice
 
 config BR2_PTHREADS_NATIVE
 	bool "Native POSIX Threading (NPTL)"
-	depends on BR2_USE_MMU
+	depends on BR2_USE_MMU || ((BR2_arm || BR2_armeb) && BR2_BINFMT_FDPIC)
 	select BR2_TOOLCHAIN_HAS_THREADS
 	select BR2_TOOLCHAIN_HAS_THREADS_NPTL
 
-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [PATCH v3 8/8] package/pkg-autotools: patch libtool to support ARM FDPIC
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
                   ` (6 preceding siblings ...)
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 7/8] package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC Ben Wolsieffer
@ 2022-08-19 15:17 ` Ben Wolsieffer
  2023-04-16 19:01   ` Yann E. MORIN
  2022-08-22  9:52 ` [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Waldemar Brodkorb
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-19 15:17 UTC (permalink / raw)
  To: buildroot
  Cc: Vladimir Murzin, Yann E. MORIN, Ben Wolsieffer, Thomas Petazzoni,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

Patch the target matching code in libtool to understand
arm-*-uclinuxfdpiceabi targets. To avoid the need to run autoreconf,
this patching must be performed in the configure script.

Without this patch, libtool refuses to build ARM FDPIC shared libraries.
This is especially important because NPTL thread-local storage is broken
in static libraries that are linked into dynamic FDPIC executables.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
---
 package/pkg-autotools.mk | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
index b6224b349d..60e70a6e2f 100644
--- a/package/pkg-autotools.mk
+++ b/package/pkg-autotools.mk
@@ -87,6 +87,16 @@ define CONFIGURE_FIX_POWERPC64_HOOK
 	support/scripts/fix-configure-powerpc64.sh $($(PKG)_DIR)
 endef
 
+#
+# Hook to add support for arm-*-uclinuxfdpiceabi to the configure script
+#
+define CONFIGURE_FIX_UCLINUXFDPICEABI_HOOK
+	@$(call MESSAGE,"Adding uclinuxfdpiceabi to configure")
+	find $($(PKG)_DIR) -name configure \
+		-exec grep -qF 'Generated by GNU Autoconf' {} \; \
+		-exec sed -Ei 's#((\s|^)linux\*\B)#\1 | uclinuxfdpiceabi#' '{}' \;
+endef
+
 #
 # Hook to gettextize the package if needed
 #
@@ -269,6 +279,13 @@ ifneq ($$(filter powerpc64%,$$(if $$(filter target,$(4)),$$(ARCH),$$(HOSTARCH)))
 $(2)_PRE_CONFIGURE_HOOKS += CONFIGURE_FIX_POWERPC64_HOOK
 endif
 
+# Append a configure hook if building for ARM with FDPIC enabled.
+# Must be added after other pre-configure hooks that might regenerate the
+# configure script and overwrite the changes made here.
+ifeq ($(BR2_arm)$(BR2_armeb):$(BR2_BINFMT_FDPIC),y:y)
+$(2)_PRE_CONFIGURE_HOOKS += CONFIGURE_FIX_UCLINUXFDPICEABI_HOOK
+endif
+
 #
 # Build step. Only define it if not already defined by the package .mk
 # file.
-- 
2.37.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
                   ` (7 preceding siblings ...)
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 8/8] package/pkg-autotools: patch libtool to support ARM FDPIC Ben Wolsieffer
@ 2022-08-22  9:52 ` Waldemar Brodkorb
  2022-08-26  3:22   ` Ben Wolsieffer
  2022-09-22 13:18 ` Waldemar Brodkorb
  2023-09-30 20:12 ` Thomas Petazzoni via buildroot
  10 siblings, 1 reply; 17+ messages in thread
From: Waldemar Brodkorb @ 2022-08-22  9:52 UTC (permalink / raw)
  To: Ben Wolsieffer
  Cc: Vladimir Murzin, Yann E. MORIN, Thomas Petazzoni, buildroot,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

Hi Ben,

on what hardware or simulator you are testing?
I like to try stm32 hardware, but the toolchain conflicts with
afboot-stm32. 
best regards
 Waldemar

Ben Wolsieffer wrote,

> Introduce support for the FDPIC binary format on ARM. FDPIC binaries
> enable memory sharing between processes on no-MMU systems.
> 
> Changes in v3:
>   * Don't change default binary format
>   * Disable FDPIC support with external toolchains
>   * Enable NPTL if FDPIC is used
>   * Patch libtool to support ARM FDPIC shared libraries
> 
> Changes in v2:
>   * Simplify special casing of FDPIC toolchain target
>   * Add additional patches to fix building Linux and U-Boot with an
>     FDPIC toolchain by passing -mno-fdpic. I have submitted fixes
>     upstream to do this automatically, but they have not yet been
>     accepted and will take a while to end up in Buildroot.
> 
> Cc: Vladimir Murzin <vladimir.murzin@arm.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> Ben Wolsieffer (8):
>   Revert "arch: drop now useless support for FDPIC"
>   arch: don't enable FDPIC binaries by default
>   arch: make FDPIC dependent on toolchain support
>   arch/arm: add support for FDPIC
>   boot/uboot: pass -mno-fdpic if FDPIC is enabled
>   linux: pass -mno-fdpic if FDPIC is enabled
>   package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
>   package/pkg-autotools: patch libtool to support ARM FDPIC
> 
>  arch/Config.in           | 15 +++++++++++++++
>  boot/uboot/uboot.mk      |  5 +++++
>  linux/linux.mk           |  8 +++++++-
>  package/Makefile.in      |  6 ++++++
>  package/pkg-autotools.mk | 17 +++++++++++++++++
>  package/uclibc/Config.in |  2 +-
>  package/uclibc/uclibc.mk |  8 ++++++++
>  toolchain/Config.in      |  4 ++++
>  8 files changed, 63 insertions(+), 2 deletions(-)
> 
> -- 
> 2.37.0
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM
  2022-08-22  9:52 ` [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Waldemar Brodkorb
@ 2022-08-26  3:22   ` Ben Wolsieffer
  0 siblings, 0 replies; 17+ messages in thread
From: Ben Wolsieffer @ 2022-08-26  3:22 UTC (permalink / raw)
  To: buildroot

Hi Waldemar,

On Mon, Aug 22, 2022 at 11:52:39AM +0200, Waldemar Brodkorb wrote:
> Hi Ben,
> 
> on what hardware or simulator you are testing?
> I like to try stm32 hardware, but the toolchain conflicts with
> afboot-stm32. 

I'm using the Emcraft STM32F746 SOM [1], with mainline Linux 5.19,
U-Boot 2022.07 and a custom device tree (and a few patches, although I
don't think any of them are necessary to get the kernel to boot).       

By the way, I was working on these patches as part of an internship,
which has now ended, so I don't have access to my work email anymore.
I'm still interested in getting these patches merged, but please reply
to my personal email (benwolsieffer at gmail.com), although I will keep
checking the list archives for replies.                                                                                                                                                                                                       
                                                                                                                                                                                                                                              
[1] https://emcraft.com/som/stm32f7

> best regards
>  Waldemar
> 
> Ben Wolsieffer wrote,
> 
> > Introduce support for the FDPIC binary format on ARM. FDPIC binaries
> > enable memory sharing between processes on no-MMU systems.
> > 
> > Changes in v3:
> >   * Don't change default binary format
> >   * Disable FDPIC support with external toolchains
> >   * Enable NPTL if FDPIC is used
> >   * Patch libtool to support ARM FDPIC shared libraries
> > 
> > Changes in v2:
> >   * Simplify special casing of FDPIC toolchain target
> >   * Add additional patches to fix building Linux and U-Boot with an
> >     FDPIC toolchain by passing -mno-fdpic. I have submitted fixes
> >     upstream to do this automatically, but they have not yet been
> >     accepted and will take a while to end up in Buildroot.
> > 
> > Cc: Vladimir Murzin <vladimir.murzin at arm.com>
> > Cc: "Yann E. MORIN" <yann.morin.1998 at free.fr>
> > 
> > Ben Wolsieffer (8):
> >   Revert "arch: drop now useless support for FDPIC"
> >   arch: don't enable FDPIC binaries by default
> >   arch: make FDPIC dependent on toolchain support
> >   arch/arm: add support for FDPIC
> >   boot/uboot: pass -mno-fdpic if FDPIC is enabled
> >   linux: pass -mno-fdpic if FDPIC is enabled
> >   package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
> >   package/pkg-autotools: patch libtool to support ARM FDPIC
> > 
> >  arch/Config.in           | 15 +++++++++++++++
> >  boot/uboot/uboot.mk      |  5 +++++
> >  linux/linux.mk           |  8 +++++++-
> >  package/Makefile.in      |  6 ++++++
> >  package/pkg-autotools.mk | 17 +++++++++++++++++
> >  package/uclibc/Config.in |  2 +-
> >  package/uclibc/uclibc.mk |  8 ++++++++
> >  toolchain/Config.in      |  4 ++++
> >  8 files changed, 63 insertions(+), 2 deletions(-)
> > 
> > -- 
> > 2.37.0
> > 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
                   ` (8 preceding siblings ...)
  2022-08-22  9:52 ` [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Waldemar Brodkorb
@ 2022-09-22 13:18 ` Waldemar Brodkorb
  2023-09-30 20:12 ` Thomas Petazzoni via buildroot
  10 siblings, 0 replies; 17+ messages in thread
From: Waldemar Brodkorb @ 2022-09-22 13:18 UTC (permalink / raw)
  To: Ben Wolsieffer
  Cc: Vladimir Murzin, Yann E. MORIN, Thomas Petazzoni, buildroot,
	Romain Naour, Giulio Benetti, Thomas De Schampheleire

Hi Ben, Hi all,

I tested this on my STM32F746G-DISCO device I got via eBay.

I had to tweak the userland a little bit. I had to disable
BUSYBOX_STATIC as static FDPIC is not supported. The binary
will end up using /usr/lib/ld.so.1 as interpreter even when static 
build is used. This is a known limitation.

Secondly I had to disable libm in uClibc-ng to get a smaller libc
otherwise busybox hush was triggering a malloc failure trying to use 
to much memory for this small device.

I am now testing to use individual busybox binaries and libbusybox,
which might work, too.

So for the complete series you can add a:
Tested-By: Waldemar Brodkorb <wbx@openadk.org>

best regards
 Waldemar

Ben Wolsieffer wrote,

> Introduce support for the FDPIC binary format on ARM. FDPIC binaries
> enable memory sharing between processes on no-MMU systems.
> 
> Changes in v3:
>   * Don't change default binary format
>   * Disable FDPIC support with external toolchains
>   * Enable NPTL if FDPIC is used
>   * Patch libtool to support ARM FDPIC shared libraries
> 
> Changes in v2:
>   * Simplify special casing of FDPIC toolchain target
>   * Add additional patches to fix building Linux and U-Boot with an
>     FDPIC toolchain by passing -mno-fdpic. I have submitted fixes
>     upstream to do this automatically, but they have not yet been
>     accepted and will take a while to end up in Buildroot.
> 
> Cc: Vladimir Murzin <vladimir.murzin@arm.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> Ben Wolsieffer (8):
>   Revert "arch: drop now useless support for FDPIC"
>   arch: don't enable FDPIC binaries by default
>   arch: make FDPIC dependent on toolchain support
>   arch/arm: add support for FDPIC
>   boot/uboot: pass -mno-fdpic if FDPIC is enabled
>   linux: pass -mno-fdpic if FDPIC is enabled
>   package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
>   package/pkg-autotools: patch libtool to support ARM FDPIC
> 
>  arch/Config.in           | 15 +++++++++++++++
>  boot/uboot/uboot.mk      |  5 +++++
>  linux/linux.mk           |  8 +++++++-
>  package/Makefile.in      |  6 ++++++
>  package/pkg-autotools.mk | 17 +++++++++++++++++
>  package/uclibc/Config.in |  2 +-
>  package/uclibc/uclibc.mk |  8 ++++++++
>  toolchain/Config.in      |  4 ++++
>  8 files changed, 63 insertions(+), 2 deletions(-)
> 
> -- 
> 2.37.0
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Buildroot] [PATCH v3 4/8] arch/arm: add support for FDPIC
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 4/8] arch/arm: add support for FDPIC Ben Wolsieffer
@ 2023-04-16 16:22   ` Yann E. MORIN
  0 siblings, 0 replies; 17+ messages in thread
From: Yann E. MORIN @ 2023-04-16 16:22 UTC (permalink / raw)
  To: Ben Wolsieffer
  Cc: Vladimir Murzin, Thomas Petazzoni, buildroot, Romain Naour,
	Giulio Benetti, Thomas De Schampheleire

Ben, All,

Sorry for the overly long delay, but as you can imagine, it is not
something that is trivial to review. Even so, here's an long overdue
review...

On 2022-08-19 11:17 -0400, Ben Wolsieffer spake thusly:
> 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 an 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>
> ---
>  arch/Config.in      | 1 +
>  package/Makefile.in | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/arch/Config.in b/arch/Config.in
> index 4cd58041a4..c639738f5f 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 ff60f85092..81a7028275 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -37,7 +37,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

This looks weird: it looks like they coalesced OS and ABI, and dropped
the LIBC part...

> +else
>  GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI)
> +endif

I am not too fond of this special casing. What about something along the
lines of (existing comments stripped):

    TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)$(LIBC)$(ABI)))
    # Note no dash between OS and LIBC  --------------^^

    ifeq ($(BR2_arm)$(BR2_armeb)$(BR2_BINFMT_FDPIC),yy)
    # For ARM FDPIC, there is no separation between OS and ABI
    TARGET_OS = uclinux
    else ifeq ($(BR2_BINFMT_FLAT):$(BR2_RISCV_64),y:)
    TARGET_OS = uclinux-
    else
    TARGET_OS = linux-
    endif

    ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
    # For ARM FDPIC, there's no LIBC part
    ifneq ($(BR2_arm)$(BR2_armeb)$(BR2_BINFMT_FDPIC),yy)
    LIBC = uclibc
    endif
    else ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
    LIBC = musl
    else ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
    LIBC = gnu
    else ifeq ($(BR_BUILDING),y)
    $(error No C library enabled, this is not possible.)
    endif

    ifeq ($(BR2_arm)$(BR2_armeb),y)
    ifeq ($(LIBC),uclibc)
    ABI = $(if $(BR2_BINFMT_FDPIC),fdpic,gnu)eabi
    else
    ABI = eabi
    endif

    ifeq ($(BR2_ARM_EABIHF),y)
    # FDPIC is always HF, so don't append the hf suffix (FIXME!)
    ABI := $(ABI)$(if $(BR2_BINFMT_FDPIC),,hf)
    endif
    endif

Note that this is not perfect, as there are a few assumptions hard-coded
in there, but I'm afraid we can't do much much better...

Note that I have no idea about the HF part, so I wrote something for
illustration purposes only...

Regards,
Yann E. MORIN.

>  # FLAT binary format needs uclinux, except RISC-V 64-bits which needs
>  # the regular linux name.
> -- 
> 2.37.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Buildroot] [PATCH v3 8/8] package/pkg-autotools: patch libtool to support ARM FDPIC
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 8/8] package/pkg-autotools: patch libtool to support ARM FDPIC Ben Wolsieffer
@ 2023-04-16 19:01   ` Yann E. MORIN
  0 siblings, 0 replies; 17+ messages in thread
From: Yann E. MORIN @ 2023-04-16 19:01 UTC (permalink / raw)
  To: Ben Wolsieffer
  Cc: Vladimir Murzin, Thomas Petazzoni, buildroot, Romain Naour,
	Giulio Benetti, Thomas De Schampheleire

Ben, All,

On 2022-08-19 11:17 -0400, Ben Wolsieffer spake thusly:
> Patch the target matching code in libtool to understand
> arm-*-uclinuxfdpiceabi targets. To avoid the need to run autoreconf,
> this patching must be performed in the configure script.
> 
> Without this patch, libtool refuses to build ARM FDPIC shared libraries.
> This is especially important because NPTL thread-local storage is broken
> in static libraries that are linked into dynamic FDPIC executables.

If static build is known to be broken with FDPIC, then maybe we should
just forbid it:

    config BR2_STATIC_LIBS
        bool "static only"
        depends on BR2_BINFMT_SUPPORTS_STATIC
        depends on !BR2_TOOLCHAIN_USES_GLIBC

    comment "static only needs a toolchain w/ uclibc or musl"
        depends on BR2_BINFMT_SUPPORTS_STATIC
        depends on BR2_TOOLCHAIN_USES_GLIBC

    config BR2_SHARED_LIBS
        bool "shared only"
        depends on BR2_BINFMT_SUPPORTS_SHARED

    config BR2_SHARED_STATIC_LIBS
        bool "both static and shared"
        depends on BR2_BINFMT_SUPPORTS_STATIC && BR2_BINFMT_SUPPORTS_SHARED

BR2_BINFMT_SUPPORTS_STATIC would be a new symbol that BR2_BINFMT_ELF
and BR2_BINFMT_FLAT would select, but not BR2_BINFMT_FDPIC.

Regards,
Yann E. MORIN.

> Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
> ---
>  package/pkg-autotools.mk | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
> index b6224b349d..60e70a6e2f 100644
> --- a/package/pkg-autotools.mk
> +++ b/package/pkg-autotools.mk
> @@ -87,6 +87,16 @@ define CONFIGURE_FIX_POWERPC64_HOOK
>  	support/scripts/fix-configure-powerpc64.sh $($(PKG)_DIR)
>  endef
>  
> +#
> +# Hook to add support for arm-*-uclinuxfdpiceabi to the configure script
> +#
> +define CONFIGURE_FIX_UCLINUXFDPICEABI_HOOK
> +	@$(call MESSAGE,"Adding uclinuxfdpiceabi to configure")
> +	find $($(PKG)_DIR) -name configure \
> +		-exec grep -qF 'Generated by GNU Autoconf' {} \; \
> +		-exec sed -Ei 's#((\s|^)linux\*\B)#\1 | uclinuxfdpiceabi#' '{}' \;
> +endef
> +
>  #
>  # Hook to gettextize the package if needed
>  #
> @@ -269,6 +279,13 @@ ifneq ($$(filter powerpc64%,$$(if $$(filter target,$(4)),$$(ARCH),$$(HOSTARCH)))
>  $(2)_PRE_CONFIGURE_HOOKS += CONFIGURE_FIX_POWERPC64_HOOK
>  endif
>  
> +# Append a configure hook if building for ARM with FDPIC enabled.
> +# Must be added after other pre-configure hooks that might regenerate the
> +# configure script and overwrite the changes made here.
> +ifeq ($(BR2_arm)$(BR2_armeb):$(BR2_BINFMT_FDPIC),y:y)
> +$(2)_PRE_CONFIGURE_HOOKS += CONFIGURE_FIX_UCLINUXFDPICEABI_HOOK
> +endif
> +
>  #
>  # Build step. Only define it if not already defined by the package .mk
>  # file.
> -- 
> 2.37.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM
  2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
                   ` (9 preceding siblings ...)
  2022-09-22 13:18 ` Waldemar Brodkorb
@ 2023-09-30 20:12 ` Thomas Petazzoni via buildroot
  2023-10-02 14:18   ` Ben Wolsieffer
  10 siblings, 1 reply; 17+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-09-30 20:12 UTC (permalink / raw)
  To: Ben Wolsieffer
  Cc: Vladimir Murzin, Yann E. MORIN, buildroot, Giulio Benetti,
	Romain Naour, Thomas De Schampheleire

Hello Ben,

On Fri, 19 Aug 2022 11:17:25 -0400
Ben Wolsieffer <ben.wolsieffer@hefring.com> wrote:

> Ben Wolsieffer (8):
>   Revert "arch: drop now useless support for FDPIC"
>   arch: don't enable FDPIC binaries by default
>   arch: make FDPIC dependent on toolchain support
>   arch/arm: add support for FDPIC
>   boot/uboot: pass -mno-fdpic if FDPIC is enabled
>   linux: pass -mno-fdpic if FDPIC is enabled
>   package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
>   package/pkg-autotools: patch libtool to support ARM FDPIC

Thanks for submitting this, and as Yann said already many months ago,
sorry for the delay.

To be honest, we're not entirely sure we want to merge this without a
really active user of it. The changes are not too complicated, but it's
another fairly special use-case to support, and we would really like to
have someone using it "for real" before we merge this.

Also, Waldemar pointed out a number of small issues he encountered
while testing this. There's not been activity on this topic for a year,
so we're not sure how committed you are to pushing this and more
importantly maintaining this.

Could you provide more details on whether you're actually using this in
a project/product? Or is anyone else using this, or going to use it?

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Buildroot] [PATCH v3 5/8] boot/uboot: pass -mno-fdpic if FDPIC is enabled
  2022-08-19 15:17 ` [Buildroot] [PATCH v3 5/8] boot/uboot: pass -mno-fdpic if FDPIC is enabled Ben Wolsieffer
@ 2023-09-30 20:36   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-09-30 20:36 UTC (permalink / raw)
  To: Ben Wolsieffer
  Cc: Vladimir Murzin, Yann E. MORIN, buildroot, Giulio Benetti,
	Romain Naour, Thomas De Schampheleire

On Fri, 19 Aug 2022 11:17:30 -0400
Ben Wolsieffer <ben.wolsieffer@hefring.com> wrote:

> +# Disable FDPIC if enabled by default in toolchain
> +ifeq ($(BR2_BINFMT_FDPIC),y)
> +UBOOT_MAKE_OPTS += KCFLAGS=-mno-fdpic
> +endif

This this one and the same change in the linux/ package, I'm not a
super super fan, even if I admit I'm not sure I have a better solution
to offer. I tend to not like very much this kind of super arch-specific
CFLAGS customization sprinkled in different places.

My initial thought when looking at this was "could it be done directly
by the toolchain-wrapper"? Indeed, we already have some logic to detect
if the code being built is from the kernel (__KERNEL__ is defined) or
U-Boot (__UBOOT__ is defined).

Another concern is what about other bootloaders or piece of
freestanding code that also shouldn't be built -mfdpic?

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM
  2023-09-30 20:12 ` Thomas Petazzoni via buildroot
@ 2023-10-02 14:18   ` Ben Wolsieffer
  0 siblings, 0 replies; 17+ messages in thread
From: Ben Wolsieffer @ 2023-10-02 14:18 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Vladimir Murzin, Yann E. MORIN, buildroot, Giulio Benetti,
	Romain Naour, Thomas De Schampheleire

Hi Thomas,

On Sat, Sep 30, 2023 at 10:12:18PM +0200, Thomas Petazzoni wrote:
> Hello Ben,
> 
> On Fri, 19 Aug 2022 11:17:25 -0400
> Ben Wolsieffer <ben.wolsieffer@hefring.com> wrote:
> 
> > Ben Wolsieffer (8):
> >   Revert "arch: drop now useless support for FDPIC"
> >   arch: don't enable FDPIC binaries by default
> >   arch: make FDPIC dependent on toolchain support
> >   arch/arm: add support for FDPIC
> >   boot/uboot: pass -mno-fdpic if FDPIC is enabled
> >   linux: pass -mno-fdpic if FDPIC is enabled
> >   package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC
> >   package/pkg-autotools: patch libtool to support ARM FDPIC
> 
> Thanks for submitting this, and as Yann said already many months ago,
> sorry for the delay.
> 
> To be honest, we're not entirely sure we want to merge this without a
> really active user of it. The changes are not too complicated, but it's
> another fairly special use-case to support, and we would really like to
> have someone using it "for real" before we merge this.
> 
> Also, Waldemar pointed out a number of small issues he encountered
> while testing this. There's not been activity on this topic for a year,
> so we're not sure how committed you are to pushing this and more
> importantly maintaining this.
> 
> Could you provide more details on whether you're actually using this in
> a project/product? Or is anyone else using this, or going to use it?
> 
> Best regards,
> 
> Thomas
> -- 
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com

No problem about the delay, we haven't had a chance to work on this
again until recently either. We are actively using this feature now on a
custom platform based around Emcraft's STM32F746 SOM [1]. I have a
version of these patches locally that addresses most of the feedback
from the first submission, and I just need to fix a few more things
before submitting it again.

Thanks, Ben

[1] https://emcraft.com/products/700
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-10-02 14:18 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-19 15:17 [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 1/8] Revert "arch: drop now useless support for FDPIC" Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 2/8] arch: don't enable FDPIC binaries by default Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 3/8] arch: make FDPIC dependent on toolchain support Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 4/8] arch/arm: add support for FDPIC Ben Wolsieffer
2023-04-16 16:22   ` Yann E. MORIN
2022-08-19 15:17 ` [Buildroot] [PATCH v3 5/8] boot/uboot: pass -mno-fdpic if FDPIC is enabled Ben Wolsieffer
2023-09-30 20:36   ` Thomas Petazzoni via buildroot
2022-08-19 15:17 ` [Buildroot] [PATCH v3 6/8] linux: " Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 7/8] package/uclibc: enable NPTL on no-MMU ARM w/ FDPIC Ben Wolsieffer
2022-08-19 15:17 ` [Buildroot] [PATCH v3 8/8] package/pkg-autotools: patch libtool to support ARM FDPIC Ben Wolsieffer
2023-04-16 19:01   ` Yann E. MORIN
2022-08-22  9:52 ` [Buildroot] [PATCH v3 0/8] Add support for FDPIC binaries on ARM Waldemar Brodkorb
2022-08-26  3:22   ` Ben Wolsieffer
2022-09-22 13:18 ` Waldemar Brodkorb
2023-09-30 20:12 ` Thomas Petazzoni via buildroot
2023-10-02 14:18   ` Ben Wolsieffer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox