From 57ac6c83d68e3dbbca7415e06b8df8743196e51d Mon Sep 17 00:00:00 2001 From: Maciej Bocianski Date: Wed, 4 Dec 2019 14:04:30 +0100 Subject: [PATCH] component PSA: keep SVCHandler_main/tfm_pendsv_do_schedule symbol in LTO builds Add a "used" attribute to SVCHandler_main/tfm_pendsv_do_schedule to fix ARMC6 build with the "-flto" flag. This attribute, attached to a function/variable, means that code must be emitted for the function even if it appears that the function is not referenced. --- .../TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c | 3 ++- .../TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_handler.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c index 30210d940b..5ee30a614e 100644 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c +++ b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c @@ -27,6 +27,7 @@ #include "region_defs.h" #include "tfm_nspm.h" #include "tfm_memory_utils.h" +#include "platform/mbed_toolchain.h" /* * IPC partitions. @@ -580,7 +581,7 @@ void tfm_spm_init(void) tfm_thrd_start_scheduler(&this_thrd); } -void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb) +MBED_USED void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb) { #if TFM_LVL == 2 struct spm_partition_desc_t *p_next_partition; diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_handler.c b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_handler.c index 10a91a56dd..79caca211c 100644 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_handler.c +++ b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_handler.c @@ -19,6 +19,7 @@ #include #include "tfm_svcalls.h" #endif +#include "platform/mbed_toolchain.h" /* This SVC handler is called when a secure partition requests access to a * buffer area @@ -135,7 +136,7 @@ __attribute__((naked)) void SVC_Handler(void) #error "Unsupported ARM Architecture." #endif -uint32_t SVCHandler_main(uint32_t *svc_args, uint32_t lr) +MBED_USED uint32_t SVCHandler_main(uint32_t *svc_args, uint32_t lr) { uint8_t svc_number; /*