Skip to content

Commit a08d359

Browse files
committed
Revert "arch: aarch32: place .bss, .noinit sections at the end of the binary"
This reverts commit 36997de, as that's breaking few tests in CI, see: #61572 Signed-off-by: Fabio Baltieri <[email protected]>
1 parent 0538041 commit a08d359

File tree

1 file changed

+30
-32
lines changed
  • include/zephyr/arch/arm/aarch32/cortex_a_r/scripts

1 file changed

+30
-32
lines changed

include/zephyr/arch/arm/aarch32/cortex_a_r/scripts/linker.ld

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@
2626
#endif
2727
#define RAMABLE_REGION RAM
2828

29-
/* section alignment directive, valid only if not running in XIP mode */
30-
#ifndef CONFIG_XIP
31-
#define SECTION_ALIGN ALIGN(_region_min_align)
32-
#else
33-
#define SECTION_ALIGN
34-
#endif
35-
3629
#if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0)
3730
#define ROM_ADDR RAM_ADDR
3831
#else
@@ -80,6 +73,8 @@ _region_min_align = 4;
8073
. = ALIGN(_region_min_align)
8174
#endif
8275

76+
#define BSS_ALIGN ALIGN(_region_min_align)
77+
8378
MEMORY
8479
{
8580
FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE
@@ -266,10 +261,35 @@ SECTIONS
266261
_app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME);
267262
#endif /* CONFIG_USERSPACE */
268263

269-
. = ALIGN(_region_min_align);
270-
__kernel_ram_start = .;
264+
SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD), BSS_ALIGN)
265+
{
266+
/*
267+
* For performance, BSS section is assumed to be 4 byte aligned and
268+
* a multiple of 4 bytes
269+
*/
270+
. = ALIGN(4);
271+
__bss_start = .;
272+
__kernel_ram_start = .;
271273

272-
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,SECTION_ALIGN)
274+
*(.bss)
275+
*(".bss.*")
276+
*(COMMON)
277+
*(".kernel_bss.*")
278+
279+
#ifdef CONFIG_CODE_DATA_RELOCATION
280+
#include <linker_sram_bss_relocate.ld>
281+
#endif
282+
283+
/*
284+
* As memory is cleared in words only, it is simpler to ensure the BSS
285+
* section ends on a 4 byte boundary. This wastes a maximum of 3 bytes.
286+
*/
287+
__bss_end = ALIGN(4);
288+
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
289+
290+
#include <zephyr/linker/common-noinit.ld>
291+
292+
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
273293
{
274294
__data_region_start = .;
275295
__data_start = .;
@@ -303,29 +323,7 @@ SECTIONS
303323
#include <snippets-data-sections.ld>
304324

305325
__data_region_end = .;
306-
. = ALIGN(_region_min_align);
307-
308-
SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD), SECTION_ALIGN)
309-
{
310-
__bss_start = .;
311-
312-
*(.bss)
313-
*(".bss.*")
314-
*(COMMON)
315-
*(".kernel_bss.*")
316326

317-
#ifdef CONFIG_CODE_DATA_RELOCATION
318-
#include <linker_sram_bss_relocate.ld>
319-
#endif
320-
321-
/*
322-
* As memory is cleared in words only, it is simpler to ensure the BSS
323-
* section ends on a 4 byte boundary. This wastes a maximum of 3 bytes.
324-
*/
325-
__bss_end = ALIGN(4);
326-
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
327-
328-
#include <zephyr/linker/common-noinit.ld>
329327

330328
/* Define linker symbols */
331329

0 commit comments

Comments
 (0)