diff mbox series

[v2] arm-bsp/trusted-firmware-a: don't set LD if LTO is enabled

Message ID 20260524110807.3219388-1-skandigraun@gmail.com
State New
Headers show
Series [v2] arm-bsp/trusted-firmware-a: don't set LD if LTO is enabled | expand

Commit Message

Gyorgy Sarvari May 24, 2026, 11:08 a.m. UTC
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.

The option is disabled by default to keep the existing behavior.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---

I ran into this while working on a PinePhone project. If it would be better to
use CC explicitly instead of leaving LD empty (or anything else), let me know.

v2: The opening quote was placed at a wrong position - should be fixed.

 .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

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..3819a6de 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'))}'"