From 3c07303388bf1fa286bbb6f5b5b6189635787103 Mon Sep 17 00:00:00 2001 From: Gyorgy Sarvari Date: Sun, 24 May 2026 12:39:28 +0200 Subject: [PATCH] arm/trusted-firmware-a: don't set LD if LTO is enabled Some platforms (like Allwinner A64/sun50i_a64) have LTO enabled in the Makefiles, which causes a linking error when using ld: | [...]/aarch64-oe-linux/aarch64-oe-linux-ld: -f may not be used without -shared Add an option to be able to indicate in the recipe if the plaform has LTO enabled, and only pass LD to make in case LTO is disabled, otherwise let it use $CC (as set by the Makefile). The option is disabled by default to keep the existing behavior. Signed-off-by: Gyorgy Sarvari Signed-off-by: Jon Mason --- .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc index 6a2c0da9..62204042 100644 --- a/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +++ b/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc @@ -38,6 +38,9 @@ TFA_ARM_SPMC_MANIFEST_DTS ?= "" # Build for debug (set TFA_DEBUG to 1 to activate) TFA_DEBUG ?= "${FIRMWARE_DEBUG_BUILD}" +# Set to 1 if the platform has LTO enabled +TFA_LTO ?= "" + B = "${WORKDIR}/build" # mbed TLS support (set TFA_MBEDTLS to 1 to activate) @@ -106,7 +109,7 @@ def remove_options_tail (in_string): from itertools import takewhile return ' '.join(takewhile(lambda x: not x.startswith('-'), in_string.split(' '))) -EXTRA_OEMAKE += "LD='${@remove_options_tail(d.getVar('LD'))}'" +EXTRA_OEMAKE += "${@'' if d.getVar('TFA_LTO') else "'LD=" + remove_options_tail(d.getVar('LD')) + "'"}" EXTRA_OEMAKE += "CC='${@remove_options_tail(d.getVar('CC'))}'"