File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
88## [ Unreleased]
99
10+ - Align the default ` _stext ` to the alignment required by the ` .text ` section. Fixes
11+ the lld warning ` address (...) of section .text is not a multiple of alignment (...) ` .
12+ - Note: ` _stext ` is not auto-aligned if it's explicitly overridden by the user. It's their responsibility to align it, else the warning will show.
13+
1014## [ v0.7.6]
1115
1216- Mark ` pre_init ` as deprecated
Original file line number Diff line number Diff line change @@ -89,7 +89,11 @@ SECTIONS
8989 KEEP(*(.vector_table.interrupts)); /* this is the `__INTERRUPTS` symbol */
9090 } > FLASH
9191
92- PROVIDE(_stext = ADDR(.vector_table) + SIZEOF(.vector_table));
92+ /* The alignment of .text is the maximum alignment required by its input sections, which
93+ can be more than 4 (e.g. `.p2align` directives inside inline assembly). Since the
94+ start address of .text is set explicitly, the linker won't align it automatically, so do it
95+ here. */
96+ PROVIDE(_stext = ALIGN(ADDR(.vector_table) + SIZEOF(.vector_table), ALIGNOF(.text)));
9397
9498 /* ### .text */
9599 .text _stext :
Original file line number Diff line number Diff line change 113113//! _stext = ORIGIN(FLASH) + 0x40C;
114114//! ```
115115//!
116+ //! It is your responsibility to ensure `_stext` is aligned to what the `.text` section requires.
117+ //! This is typically 4 but can ocasionally be higher, such as when using `.p2align` directives inside ASM.
118+ //! If you fail to do so you will see a linker warning like `address (...) of section .text is not a multiple of alignment (...)`.
119+ //!
116120//! # An example
117121//!
118122//! This section presents a minimal application built on top of `cortex-m-rt`. Apart from the
You can’t perform that action at this time.
0 commit comments