1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-30 00:21:17 +00:00

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 <skandigraun@gmail.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Gyorgy Sarvari
2026-05-24 12:39:28 +02:00
committed by Jon Mason
parent ce5b4c4b0a
commit 3c07303388
@@ -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'))}'"