From c59923029d242843712212350d6309ac3ffb8a55 Mon Sep 17 00:00:00 2001 From: Hugues de Valon Date: Thu, 1 Oct 2020 11:44:44 +0100 Subject: [PATCH] Add a section to place the veneers in memory The veneers are for now only generated by the Arm GNU linker when it spots an entry function (one that was decorated with the cmse_nonsecure_entry attribute). Adding this section will allow to configure the SAU to make this section Non-Secure Callable. Signed-off-by: Hugues de Valon --- link.x.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/link.x.in b/link.x.in index f4f49590..f1a921d0 100644 --- a/link.x.in +++ b/link.x.in @@ -110,6 +110,18 @@ SECTIONS . = ALIGN(4); /* Ensure __erodata is aligned if something unaligned is inserted after .rodata */ __erodata = .; + /* ### .gnu.sgstubs + This section contains the TrustZone-M veneers put there by the Arm GNU linker. */ + . = ALIGN(32); /* Security Attribution Unit blocks must be 32 bytes aligned. */ + __veneer_base = ALIGN(4); + .gnu.sgstubs : ALIGN(4) + { + *(.gnu.sgstubs*) + . = ALIGN(4); /* 4-byte align the end (VMA) of this section */ + } > FLASH + . = ALIGN(4); /* Ensure __veneer_limit is aligned if something unaligned is inserted after .gnu.sgstubs */ + __veneer_limit = .; + /* ## Sections in RAM */ /* ### .data */ .data : ALIGN(4)