From 8dd9b79456ab05226179d1f49134416c8a8a3842 Mon Sep 17 00:00:00 2001 From: Paul Scheffler Date: Thu, 14 Nov 2024 14:08:29 +0100 Subject: [PATCH] sw/link: Avoid incorrect `.bss` delimiters Under some conditions, `__bss_start` and `__bss_end would not correctly delimit `.bss`. --- sw/link/dram.ld | 8 +++----- sw/link/rom.ld | 8 +++----- sw/link/spm.ld | 8 +++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/sw/link/dram.ld b/sw/link/dram.ld index 36f08fa24..f3ab33315 100644 --- a/sw/link/dram.ld +++ b/sw/link/dram.ld @@ -28,16 +28,14 @@ SECTIONS { *(.sdata.*) } > dram - . = ALIGN(32); - __bss_start = .; - .bss : { + .bss : ALIGN(16) { + __bss_start = .; *(.bss) *(.bss.*) *(.sbss) *(.sbss.*) + __bss_end = .; } > dram - . = ALIGN(32); - __bss_end = .; .bulk : ALIGN(16) { *(.bulk) diff --git a/sw/link/rom.ld b/sw/link/rom.ld index d1320dd5e..29550ae2c 100644 --- a/sw/link/rom.ld +++ b/sw/link/rom.ld @@ -27,14 +27,12 @@ SECTIONS { } > spm AT>extrom /* BSS is not loaded, but initialized by CRT0 */ - . = ALIGN(32); - __bss_start = .; - .bss : { + .bss : ALIGN(16) { + __bss_start = .; *(.bss) *(.bss.*) *(.sbss) *(.sbss.*) + __bss_end = .; } > spm - . = ALIGN(32); - __bss_end = .; } diff --git a/sw/link/spm.ld b/sw/link/spm.ld index 5aaaaed94..bedd94734 100644 --- a/sw/link/spm.ld +++ b/sw/link/spm.ld @@ -26,16 +26,14 @@ SECTIONS { *(.sdata.*) } > spm - . = ALIGN(32); - __bss_start = .; - .bss : { + .bss : ALIGN(16) { + __bss_start = .; *(.bss) *(.bss.*) *(.sbss) *(.sbss.*) + __bss_end = .; } > spm - . = ALIGN(32); - __bss_end = .; .bulk : ALIGN(16) { *(.bulk)