[v2,5/9] boot/uboot: pass -mno-fdpic if FDPIC is enabled

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

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>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
No changes since v1

 boot/uboot/uboot.mk | 5 +++++
 1 file changed, 5 insertions(+)

Comments

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

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

> From: Ben Wolsieffer <ben.wolsieffer@hefring.com>
> 
> 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>
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

This patch and PATCH 6/9 which does the same for the Linux package makes me wonder what is the right approach, and I am not fully clear.

Indeed, we already have some logic in the toolchain-wrapper to pass or
not pass certain flags when we're building U-Boot or the kernel.

However, in this case, FDPIC is enabled by default, and the wrapper
would have to disable FDPIC when building U-Boot/Linux, which isn't
what the wrapper is doing today. So I'm a bit unsure on what's the best
approach between what you're proposing, and handling things in the
wrapper. Perhaps we need to try what you proposed, and see if it works
well for all use-cases.

Thomas

Patch

diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index ab534a8b3a20..d8faef648fad 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -172,6 +172,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)