Skip to content

Commit c4aa52c

Browse files
committed
Fix INSERT AFTER for .text and .bss
Additionally, include COMMON symbols (uninitialized statics from C) in bss.
1 parent 972f60f commit c4aa52c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cortex-m-rt/link.x.in

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ SECTIONS
8888
*(.text .text.*);
8989
*(.HardFaultTrampoline);
9090
*(.HardFault.*);
91-
. = ALIGN(4);
92-
__etext = .;
9391
} > FLASH
92+
. = ALIGN(4);
93+
__etext = .; /* Define outside of .text to allow using INSERT AFTER .text */
9494

9595
/* ### .rodata */
9696
.rodata __etext : ALIGN(4)
@@ -119,14 +119,15 @@ SECTIONS
119119
__sidata = LOADADDR(.data);
120120

121121
/* ### .bss */
122+
. = ALIGN(4);
123+
__sbss = .; /* Define outside of section to include INSERT BEFORE/AFTER symbols */
122124
.bss (NOLOAD) : ALIGN(4)
123125
{
124-
. = ALIGN(4);
125-
__sbss = .;
126126
*(.bss .bss.*);
127-
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
128-
__ebss = .;
127+
*(COMMON); /* Uninitialized C statics */
129128
} > RAM
129+
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
130+
__ebss = .;
130131

131132
/* ### .uninit */
132133
.uninit (NOLOAD) : ALIGN(4)

0 commit comments

Comments
 (0)