@@ -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'))}'"
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(-)