Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

Commit 2c5077a

Browse files
committed
Workaround lld bug and ensure sections and symbols are aligned
1 parent 1fd84a8 commit 2c5077a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

link.x.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ SECTIONS
8888
*(.text .text.*);
8989
*(.HardFaultTrampoline);
9090
*(.HardFault.*);
91+
. = ALIGN(4); /* Pad .text to the alignment to workaround overlapping load section bug in old lld */
9192
} > FLASH
92-
. = ALIGN(4);
93+
. = ALIGN(4); /* Ensure __etext is aligned if something unaligned is inserted after .text */
9394
__etext = .; /* Define outside of .text to allow using INSERT AFTER .text */
9495

9596
/* ### .rodata */
@@ -125,8 +126,9 @@ SECTIONS
125126
{
126127
*(.bss .bss.*);
127128
*(COMMON); /* Uninitialized C statics */
129+
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
128130
} > RAM
129-
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
131+
. = ALIGN(4); /* Ensure __ebss is aligned if something unaligned is inserted after .bss */
130132
__ebss = .;
131133

132134
/* ### .uninit */

0 commit comments

Comments
 (0)