Skip to content

Commit 6c28c81

Browse files
bors[bot]luojia65
andauthored
Merge #434
434: rt: fix veneer limit position in linker script r=adamgreig a=luojia65 This pull request fixes a CMSE related bug. If we define `#[cmse_nonsecure_call]` segments it would generate functions in `.gnu.sgstubs`, but we would eventually found out that for unknown reason `__veneer_base` == `__veneer_limit`, where SAU configuration to this segment would be impossible. The reason for this bug is unknown, but after this pull request it would link into correct limit value. I wrote an example for this fix: https://github.com/IoTS-P/trustzone-m-rs/tree/sgstub-fixed . Before this pull request, this project builds but it would print like `SG function stub region is at 0x10005fc0 .. 0x10005fc0`, resulting in secure fault. After this pull request, it would print `SG function stub region is at 0x10005fc0 .. 0x10005fe0` and runs successfully. Co-authored-by: luojia65 <[email protected]>
2 parents ec7f7c9 + 1606c88 commit 6c28c81

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cortex-m-rt/link.x.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,12 @@ SECTIONS
144144
__veneer_base = .;
145145
*(.gnu.sgstubs*)
146146
. = ALIGN(32);
147-
__veneer_limit = .;
148147
} > FLASH
148+
/* Place `__veneer_limit` outside the `.gnu.sgstubs` section because veneers are
149+
* always inserted last in the section, which would otherwise be _after_ the `__veneer_limit` symbol.
150+
*/
151+
. = ALIGN(32);
152+
__veneer_limit = .;
149153

150154
/* ### .bss */
151155
.bss (NOLOAD) : ALIGN(4)

0 commit comments

Comments
 (0)