Skip to content

Commit 7ac8f78

Browse files
bors[bot]hug-dev
andauthored
Merge #297
297: Add a section to place the veneers in memory r=jonas-schievink a=hug-dev 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. Doing tests locally I could not see any warnings if this section was empty so I think this is fine. It is highly specific to the GNU toolchain so maybe you would want some preprocessing directive and `cfg` options which I am happy to add. There is documentation for the section name at the end of [this page](https://sourceware.org/binutils/docs/ld/ARM.html). It needs to be aligned on 32 bytes as a requirement from the Security Attribute Unit. Co-authored-by: Hugues de Valon <[email protected]>
2 parents 109a832 + eff9065 commit 7ac8f78

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cortex-m-rt/link.x.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ SECTIONS
110110
. = ALIGN(4); /* Ensure __erodata is aligned if something unaligned is inserted after .rodata */
111111
__erodata = .;
112112

113+
/* ### .gnu.sgstubs
114+
This section contains the TrustZone-M veneers put there by the Arm GNU linker. */
115+
. = ALIGN(32); /* Security Attribution Unit blocks must be 32 bytes aligned. */
116+
__veneer_base = ALIGN(4);
117+
.gnu.sgstubs : ALIGN(4)
118+
{
119+
*(.gnu.sgstubs*)
120+
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
121+
} > FLASH
122+
. = ALIGN(4); /* Ensure __veneer_limit is aligned if something unaligned is inserted after .gnu.sgstubs */
123+
__veneer_limit = .;
124+
113125
/* ## Sections in RAM */
114126
/* ### .data */
115127
.data : ALIGN(4)

0 commit comments

Comments
 (0)