aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/link.x.in
diff options
context:
space:
mode:
Diffstat (limited to 'cortex-m-rt/link.x.in')
-rw-r--r--cortex-m-rt/link.x.in23
1 files changed, 14 insertions, 9 deletions
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in
index a502a03..f5e582e 100644
--- a/cortex-m-rt/link.x.in
+++ b/cortex-m-rt/link.x.in
@@ -88,9 +88,10 @@ SECTIONS
*(.text .text.*);
*(.HardFaultTrampoline);
*(.HardFault.*);
- . = ALIGN(4);
- __etext = .;
+ . = ALIGN(4); /* Pad .text to the alignment to workaround overlapping load section bug in old lld */
} > FLASH
+ . = ALIGN(4); /* Ensure __etext is aligned if something unaligned is inserted after .text */
+ __etext = .; /* Define outside of .text to allow using INSERT AFTER .text */
/* ### .rodata */
.rodata __etext : ALIGN(4)
@@ -101,32 +102,36 @@ SECTIONS
This is required by LLD to ensure the LMA of the following .data
section will have the correct alignment. */
. = ALIGN(4);
- __erodata = .;
} > FLASH
+ . = ALIGN(4); /* Ensure __erodata is aligned if something unaligned is inserted after .rodata */
+ __erodata = .;
/* ## Sections in RAM */
/* ### .data */
- .data : AT(__erodata) ALIGN(4)
+ .data : ALIGN(4)
{
. = ALIGN(4);
__sdata = .;
*(.data .data.*);
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
- __edata = .;
- } > RAM
+ } > RAM AT>FLASH
+ . = ALIGN(4); /* Ensure __edata is aligned if something unaligned is inserted after .data */
+ __edata = .;
/* LMA of .data */
__sidata = LOADADDR(.data);
/* ### .bss */
+ . = ALIGN(4);
+ __sbss = .; /* Define outside of section to include INSERT BEFORE/AFTER symbols */
.bss (NOLOAD) : ALIGN(4)
{
- . = ALIGN(4);
- __sbss = .;
*(.bss .bss.*);
+ *(COMMON); /* Uninitialized C statics */
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
- __ebss = .;
} > RAM
+ . = ALIGN(4); /* Ensure __ebss is aligned if something unaligned is inserted after .bss */
+ __ebss = .;
/* ### .uninit */
.uninit (NOLOAD) : ALIGN(4)