From 2f6965398c69ee59daa11f9f4eff3e2723b6fbb3 Mon Sep 17 00:00:00 2001 From: Francois Beutin Date: Tue, 11 Jul 2023 14:22:51 +0200 Subject: [PATCH] Add empty .data section enforcer in loader scripts for all targets --- target/nanos2/script.ld | 2 ++ target/nanox/script.ld | 2 ++ target/stax/script.ld | 2 ++ 3 files changed, 6 insertions(+) diff --git a/target/nanos2/script.ld b/target/nanos2/script.ld index ac27a23d0..47a298109 100644 --- a/target/nanos2/script.ld +++ b/target/nanos2/script.ld @@ -94,6 +94,8 @@ SECTIONS } > DISCARD /*> SRAM AT>FLASH = 0x00 */ + ASSERT( (_edata - _data) <= 0, ".data section must be empty" ) + .bss : { /** diff --git a/target/nanox/script.ld b/target/nanox/script.ld index ecd1bcf4d..5ef60477f 100644 --- a/target/nanox/script.ld +++ b/target/nanox/script.ld @@ -96,6 +96,8 @@ SECTIONS } > DISCARD /*> SRAM AT>FLASH = 0x00 */ + ASSERT( (_edata - _data) <= 0, ".data section must be empty" ) + /* The .init_array is initialized with functions with the constructor * attribute. Discard this section since there's no loader. */ /DISCARD/ : { diff --git a/target/stax/script.ld b/target/stax/script.ld index 0d4066494..e921f4ded 100644 --- a/target/stax/script.ld +++ b/target/stax/script.ld @@ -95,6 +95,8 @@ SECTIONS } > DISCARD /*> SRAM AT>FLASH = 0x00 */ + ASSERT( (_edata - _data) <= 0, ".data section must be empty" ) + .bss : { /**