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

arm-bsp/trusted-firmware-a: ensure native tools respect BUILD_LDFLAGS

TF-A has a number for variables to control how host binaries are built:

- Our BUILD_CC is HOSTCC; this is set in the recipes
- Our BUILD_CFLAGS is HOSTCCFLAGS; this is not set
- Our BUILD_LDFLAGS has no corresponding variable

However when uninative is enabled we really need to pass BUILD_LDFLAGS
as otherwise there can be link problems:

  ld: libcrypto.so: undefined reference to `__isoc23_strtol@GLIBC_2.38'

Patch into the TF-A makefiles support for HOSTLDFLAGS and ensure that we
set all three of the relevant BUILD_ variables.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Ross Burton
2026-01-22 17:18:05 +00:00
committed by Jon Mason
parent de6e6fe7d5
commit c3c97a6b8f
3 changed files with 34 additions and 1 deletions
@@ -0,0 +1,31 @@
From a55ee6bd2eb7e0aff6f17b933b78cb3f73ea3634 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@arm.com>
Date: Thu, 22 Jan 2026 16:16:27 +0000
Subject: [PATCH] feat(build): add HOSTLDFLAGS to pass flags to host links
There is a HOSTCCFLAGS variable to pass flags to all host compilations,
but no corresponding HOSTLDFLAGS to pass flags to host links.
Upstream-Status: Submitted [https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/47531]
Change-Id: I17441fc61e45d2ee41f9ab55a5d745bd0d2156d7
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
make_helpers/build_macros.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index 25b4fa498..a20c1ed2d 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -356,7 +356,7 @@ $(eval $(foreach src,$(SRCS),$(call MAKE_TOOL_C,$(1),$(src),$(2),$(3))))
$(DST): $(OBJS) $(filter-out %.d,$(MAKEFILE_LIST)) | $(1)
$$(s)echo " HOSTLD $$@"
- $$(q)$(host-cc) $${OBJS} -o $$@ $($(3)_LDFLAGS)
+ $$(q)$(host-cc) $${HOSTLDFLAGS} $${OBJS} -o $$@ $($(3)_LDFLAGS)
$$(s)echo
$$(s)echo "Built $$@ successfully"
$$(s)echo
--
2.43.0
@@ -159,7 +159,7 @@ EXTRA_OEMAKE += "${@bb.utils.contains('SEL2_SPMC', '1', 'ARM_SPMC_MANIFEST_DTS=$
# Tell the tools where the native OpenSSL is located
EXTRA_OEMAKE += "OPENSSL_DIR=${STAGING_DIR_NATIVE}/${prefix_native}"
# Use the correct native compiler
EXTRA_OEMAKE += "HOSTCC='${BUILD_CC}'"
EXTRA_OEMAKE += "HOSTCC='${BUILD_CC}' HOSTCCFLAGS='${BUILD_CFLAGS}' HOSTLDFLAGS='${BUILD_LDFLAGS}'"
# Runtime variables
EXTRA_OEMAKE += "RUNTIME_SYSROOT=${STAGING_DIR_HOST}"
@@ -14,3 +14,5 @@ SRC_URI_MBEDTLS = "gitsm://github.com/Mbed-TLS/mbedtls;name=mbedtls;protocol=htt
SRCREV_mbedtls = "e185d7fd85499c8ce5ca2a54f5cf8fe7dbe3f8df"
LIC_FILES_CHKSUM_MBEDTLS = "file://mbedtls/LICENSE;md5=379d5819937a6c2f1ef1630d341e026d"
SRC_URI += "file://0001-feat-build-add-HOSTLDFLAGS-to-pass-flags-to-host-lin.patch"