Use intermediate variable for TF-PSA-Crypto's contribution to LOCAL_LDFLAGS

Fix a bug whereby `crypto-common.make` was appending to `LOCAL_LDFLAGS`
before `common.make` set the initial value. This broke the build with
pthread enabled: `THREADING` was correctly getting autodetected, but the
addition of `-lpthread` to `LOCAL_LDFLAGS` didn't work.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2025-12-18 20:23:45 +01:00
parent 8a528cfed5
commit 562677945b
2 changed files with 8 additions and 3 deletions

View File

@@ -46,13 +46,15 @@ LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} \
-lpsaclient \
-lmbedtls$(SHARED_SUFFIX) \
-lmbedx509$(SHARED_SUFFIX) \
-lmbedcrypto$(SHARED_SUFFIX)
-lmbedcrypto$(SHARED_SUFFIX) \
$(TF_PSA_CRYPTO_EXTRA_LDFLAGS)
else
LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} \
-L$(MBEDTLS_PATH)/library \
-lmbedtls$(SHARED_SUFFIX) \
-lmbedx509$(SHARED_SUFFIX) \
-lmbedcrypto$(SHARED_SUFFIX)
-lmbedcrypto$(SHARED_SUFFIX) \
$(TF_PSA_CRYPTO_EXTRA_LDFLAGS)
endif
ifdef PSASIM

View File

@@ -46,6 +46,9 @@ TF_PSA_CRYPTO_LIBRARY_PRIVATE_INCLUDE = \
-I$(TF_PSA_CRYPTO_PATH)/core \
-I$(TF_PSA_CRYPTO_PATH)/drivers/builtin/src
# Extra linker flags required by the crypto library or the platform
TF_PSA_CRYPTO_EXTRA_LDFLAGS =
## Usage: $(call remove_enabled_options_crypto,PREPROCESSOR_INPUT)
## Remove the preprocessor symbols that are set in the current configuration
## from PREPROCESSOR_INPUT. Also normalize whitespace.
@@ -91,6 +94,6 @@ ifndef WINDOWS_BUILD
#$(info THREADING = $(THREADING))
ifeq ($(THREADING),pthread)
LOCAL_LDFLAGS += -lpthread
TF_PSA_CRYPTO_EXTRA_LDFLAGS += -lpthread
endif
endif