diff mbox series

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

Message ID 20220819151734.926106-6-Ben.Wolsieffer@hefring.com
State Deferred
Headers show
Series Add support for FDPIC binaries on ARM | expand

Commit Message

Ben Wolsieffer Aug. 19, 2022, 3:17 p.m. UTC
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(+)

Comments

Thomas Petazzoni Sept. 30, 2023, 8:36 p.m. UTC | #1
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
diff mbox series

Patch

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)