diff mbox series

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

Message ID 20220802202142.1770838-4-Ben.Wolsieffer@hefring.com
State Superseded
Headers show
Series Add support for FDPIC binaries on ARM | expand

Commit Message

Ben Wolsieffer Aug. 2, 2022, 8:21 p.m. UTC
If the FDPIC ABI is enabled by default in the toolchain, it must be
explicitly disabled when building U-Boot.
---
 boot/uboot/uboot.mk | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Thomas Petazzoni Aug. 2, 2022, 10:15 p.m. UTC | #1
On Tue,  2 Aug 2022 16:21:41 -0400
Ben Wolsieffer <ben.wolsieffer@hefring.com> wrote:

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

Missing SoB.

Who added -mfdpic by default? Directly the compiler?

If -mfdpic was added by our toolchain wrapper, then the toolchain
wrapper (toolchain/toolchain-wrapper.c) already has a few checks to
avoid adding -fPIE when building the kernel/U-Boot.

Thanks!

Thomas
Ben Wolsieffer Aug. 3, 2022, 9:07 p.m. UTC | #2
On Wed, Aug 03, 2022 at 12:15:27AM +0200, Thomas Petazzoni wrote:
> On Tue,  2 Aug 2022 16:21:41 -0400
> Ben Wolsieffer <ben.wolsieffer@hefring.com> wrote:
> 
> > If the FDPIC ABI is enabled by default in the toolchain, it must be
> > explicitly disabled when building U-Boot.
> 
> Missing SoB.

Sorry, will fix.

> Who added -mfdpic by default? Directly the compiler?
> 
> If -mfdpic was added by our toolchain wrapper, then the toolchain
> wrapper (toolchain/toolchain-wrapper.c) already has a few checks to
> avoid adding -fPIE when building the kernel/U-Boot.
> 

-mfdpic is enabled by default when the toolchain is configured for
arm-*-uclinuxfdpiceabi.
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)