aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cortex-m-rt/link.x.in19
1 files changed, 12 insertions, 7 deletions
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in
index 01eb521..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,8 +102,9 @@ 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 */
@@ -112,21 +114,24 @@ SECTIONS
__sdata = .;
*(.data .data.*);
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
- __edata = .;
} > 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)