Skip to content

Commit 32675cc

Browse files
authored
Merge pull request #11874 from fkjagodzinski/armc6_build-enable_lto_for_release
ARMC6: Add a build profile extension with the link-time optimizer enabled
2 parents a039979 + 083e3e5 commit 32675cc

File tree

19 files changed

+66
-21
lines changed

19 files changed

+66
-21
lines changed

components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_spm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "region_defs.h"
2828
#include "tfm_nspm.h"
2929
#include "tfm_memory_utils.h"
30+
#include "platform/mbed_toolchain.h"
3031

3132
/*
3233
* IPC partitions.
@@ -580,7 +581,7 @@ void tfm_spm_init(void)
580581
tfm_thrd_start_scheduler(&this_thrd);
581582
}
582583

583-
void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb)
584+
MBED_USED void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb)
584585
{
585586
#if TFM_LVL == 2
586587
struct spm_partition_desc_t *p_next_partition;

components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_handler.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <stdbool.h>
2020
#include "tfm_svcalls.h"
2121
#endif
22+
#include "platform/mbed_toolchain.h"
2223

2324
/* This SVC handler is called when a secure partition requests access to a
2425
* buffer area
@@ -135,7 +136,7 @@ __attribute__((naked)) void SVC_Handler(void)
135136
#error "Unsupported ARM Architecture."
136137
#endif
137138

138-
uint32_t SVCHandler_main(uint32_t *svc_args, uint32_t lr)
139+
MBED_USED uint32_t SVCHandler_main(uint32_t *svc_args, uint32_t lr)
139140
{
140141
uint8_t svc_number;
141142
/*

platform/source/mbed_alloc_wrappers.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,16 @@ extern "C" void *SUB_REALLOC(void *ptr, size_t size)
347347
memcpy(new_ptr, (void *)ptr, copy_size);
348348
free(ptr);
349349
}
350+
351+
{
352+
volatile uint8_t dummy = 0;
353+
if (dummy != 0) { // always false
354+
// this code will never be executed
355+
// it's just to tell the compiler/linker to preserve SUB_REALLOC symbol
356+
// when LTO enabled
357+
SUPER_REALLOC(NULL, 0);
358+
}
359+
}
350360
#else // #if MBED_HEAP_STATS_ENABLED
351361
new_ptr = SUPER_REALLOC(ptr, size);
352362
#endif // #if MBED_HEAP_STATS_ENABLED
@@ -369,6 +379,16 @@ extern "C" void *SUB_CALLOC(size_t nmemb, size_t size)
369379
if (ptr != NULL) {
370380
memset(ptr, 0, nmemb * size);
371381
}
382+
383+
{
384+
volatile uint8_t dummy = 0;
385+
if (dummy != 0) { // always false
386+
// this code will never be executed
387+
// it's just to tell the compiler/linker to preserve SUB_CALLOC symbol
388+
// when LTO enabled
389+
SUPER_CALLOC(NULL, 0);
390+
}
391+
}
372392
#else // #if MBED_HEAP_STATS_ENABLED
373393
ptr = SUPER_CALLOC(nmemb, size);
374394
#endif // #if MBED_HEAP_STATS_ENABLED

platform/source/mbed_retarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ extern "C" __value_in_regs struct __argc_argv $Sub$$__rt_lib_init(unsigned heapb
11411141
}
11421142
#endif
11431143

1144-
extern "C" __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
1144+
MBED_USED extern "C" __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3)
11451145
{
11461146
return _mbed_user_setup_stackheap(R0, R1, R2, R3);
11471147
}

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ extern void SramInit(void);
6262

6363
#if defined( __ICCARM__)
6464
__root
65-
#endif /* __ICCARM__ */
65+
#else
66+
__attribute__((used))
67+
#endif
6668
const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
6769
{
6870
BLANKX60,BLANKX600
@@ -139,6 +141,11 @@ WEAK_FUNCTION( DMA_SIP7_Int_Handler )
139141
/*----------------------------------------------------------------------------
140142
Exception / Interrupt Vector table
141143
*----------------------------------------------------------------------------*/
144+
#if defined( __ICCARM__)
145+
__root
146+
#else
147+
__attribute__((used))
148+
#endif
142149
const pFunc SECTION_PLACE(IVT_NAME[104],VECTOR_SECTION) =
143150
{
144151
(pFunc) INITIAL_SP, /* Initial Stack Pointer */

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ extern void SramInit(void);
6060
Checksum options
6161
*----------------------------------------------------------------------------*/
6262

63-
#if defined(__ICCARM__)
63+
#if defined( __ICCARM__)
6464
__root
65+
#else
66+
__attribute__((used))
6567
#endif
6668
const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
6769
{
@@ -144,6 +146,11 @@ WEAK_FUNCTION( Root_Clk_Err_Handler )
144146
/*----------------------------------------------------------------------------
145147
Exception / Interrupt Vector table
146148
*----------------------------------------------------------------------------*/
149+
#if defined( __ICCARM__)
150+
__root
151+
#else
152+
__attribute__((used))
153+
#endif
147154
const pFunc SECTION_PLACE(IVT_NAME[104],VECTOR_SECTION) = {
148155
(pFunc) INITIAL_SP, /* Initial Stack Pointer */
149156
ADUCM4050_VECTORS

targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ WEAK_ALIAS_FUNC(TRNG_IRQHandler, Default_Handler) // 101:
207207

208208
/* Vector table */
209209
#if defined(__ARMCC_VERSION)
210-
__attribute__ ((section("RESET")))
210+
__attribute__ ((section("RESET"), used))
211211
const uint32_t __vector_handlers[] = {
212212
#elif defined(__ICCARM__)
213213
const uint32_t __vector_table[] @ ".intvec" = {

targets/TARGET_NUVOTON/TARGET_M251/device/startup_M251.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ WEAK_ALIAS_FUNC(OPA_IRQHandler, Default_Handler) // 62: OPA Interrupt
155155

156156
/* Vector table */
157157
#if defined(__ARMCC_VERSION)
158-
__attribute__ ((section("RESET")))
158+
__attribute__ ((section("RESET"), used))
159159
const uint32_t __vector_handlers[] = {
160160
#elif defined(__ICCARM__)
161161
extern uint32_t CSTACK$$Limit;

targets/TARGET_NUVOTON/TARGET_M261/device/startup_M261.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ WEAK_ALIAS_FUNC(TRNG_IRQHandler, Default_Handler) // 101:
193193

194194
/* Vector table */
195195
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
196-
__attribute__ ((section("RESET")))
196+
__attribute__ ((section("RESET"), used))
197197
const uint32_t __vector_handlers[] = {
198198
#elif defined(__ICCARM__)
199199
extern uint32_t CSTACK$$Limit;

targets/TARGET_NUVOTON/TARGET_M451/device/startup_M451Series.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ WEAK_ALIAS_FUNC(TK_IRQHandler, Default_Handler) // 63:
152152

153153
/* Vector table */
154154
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
155-
__attribute__ ((section("RESET")))
155+
__attribute__ ((section("RESET"), used))
156156
const uint32_t __vector_handlers[] = {
157157
#elif defined(__ICCARM__)
158158
extern uint32_t CSTACK$$Limit;

0 commit comments

Comments
 (0)