fix(core): reduce unnecessary section alignment
What changed, and why it matters
This commit changes two bootloader linker scripts for Trezor hardware wallets, reducing the alignment padding between code/data sections from 512 bytes down to 4 bytes. The stated purpose is to remove unnecessary padding and save flash space. There is no indication in the commit or supplied references that this fixes a security vulnerability.
No security action required. Treat as a normal size-optimization linker-script change. If auditing, verify that the reduced alignment still satisfies any hardware or cryptographic accelerator requirements (e.g., flash word size, DMA alignment, cryptographic operation buffers) for the affected STM32 platforms.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies core/embed/sys/linker/stm32f4/bootloader.ld and core/embed/sys/linker/stm32u58/bootloader.ld, changing . = ALIGN(512); to . = ALIGN(4); after .rodata* and .data* sections. This reduces section alignment requirements, likely shrinking binary size by eliminating padding. The commit title frames this as a size optimization (‘reduce unnecessary section alignment’) and includes ‘[no changelog]’. No security-relevant behavior is described or directly evident.
Changed components
core/embed/sys/linker/stm32f4/bootloader.ldcore/embed/sys/linker/stm32u58/bootloader.ldInspect captured patch +4 / −4
diff --git a/core/embed/sys/linker/stm32f4/bootloader.ld b/core/embed/sys/linker/stm32f4/bootloader.ld
index e546f818..3207dd85 100644
--- a/core/embed/sys/linker/stm32f4/bootloader.ld
+++ b/core/embed/sys/linker/stm32f4/bootloader.ld
@@ -35,7 +35,7 @@ SECTIONS {
*(.text*);
. = ALIGN(4);
*(.rodata*);
- . = ALIGN(512);
+ . = ALIGN(4);
} >FLASH AT>FLASH
.stack : ALIGN(8) {
@@ -44,7 +44,7 @@ SECTIONS {
.data : ALIGN(4) {
*(.data*);
- . = ALIGN(512);
+ . = ALIGN(4);
} >MAIN_RAM AT>FLASH
/DISCARD/ : {
diff --git a/core/embed/sys/linker/stm32u58/bootloader.ld b/core/embed/sys/linker/stm32u58/bootloader.ld
index 04a23932..4853dcf4 100644
--- a/core/embed/sys/linker/stm32u58/bootloader.ld
+++ b/core/embed/sys/linker/stm32u58/bootloader.ld
@@ -36,12 +36,12 @@ SECTIONS {
*(.text*);
. = ALIGN(4);
*(.rodata*);
- . = ALIGN(512);
+ . = ALIGN(4);
} >FLASH AT>FLASH
.data : ALIGN(4) {
*(.data*);
- . = ALIGN(512);
+ . = ALIGN(4);
} >MAIN_RAM AT>FLASH
/DISCARD/ : {
Why this scored 11/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.