Skip to content

Commit 7cd0cc6

Browse files
alewycky-tenstorrentcarlescufi
authored andcommitted
ARC: Move .bss & noinit sections to the end
Move .bss and noinit sections to the end to reduce binary size when the output format doesn't support skipping empty space. Signed-off-by: Andrew Lewycky <[email protected]>
1 parent 97f9411 commit 7cd0cc6

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

include/zephyr/arch/arc/v2/linker.ld

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -181,36 +181,14 @@ SECTIONS {
181181
_app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME);
182182
#endif /* CONFIG_USERSPACE */
183183

184-
SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) {
185-
MPU_MIN_SIZE_ALIGN
186-
/*
187-
* For performance, BSS section is assumed to be 4 byte aligned and
188-
* a multiple of 4 bytes
189-
*/
190-
. = ALIGN(4);
191-
__bss_start = .;
192-
__kernel_ram_start = .;
193-
*(".bss")
194-
*(".bss.*")
195-
*(COMMON)
196-
*(".kernel_bss.*")
197-
198-
/*
199-
* BSP clears this memory in words only and doesn't clear any
200-
* potential left over bytes.
201-
*/
202-
__bss_end = ALIGN(4);
203-
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
204-
205-
#include <zephyr/linker/common-noinit.ld>
206-
207184
GROUP_START(DATA_REGION)
208185

209186
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,) {
210187

211188
/* when XIP, .text is in ROM, but vector table must be at start of .data */
212189
__data_region_start = .;
213190
__data_start = .;
191+
__kernel_ram_start = .;
214192
*(".data")
215193
*(".data.*")
216194
*(".kernel.*")
@@ -245,6 +223,28 @@ SECTIONS {
245223

246224
__data_region_end = .;
247225

226+
SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) {
227+
MPU_MIN_SIZE_ALIGN
228+
/*
229+
* For performance, BSS section is assumed to be 4 byte aligned and
230+
* a multiple of 4 bytes
231+
*/
232+
. = ALIGN(4);
233+
__bss_start = .;
234+
*(".bss")
235+
*(".bss.*")
236+
*(COMMON)
237+
*(".kernel_bss.*")
238+
239+
/*
240+
* BSP clears this memory in words only and doesn't clear any
241+
* potential left over bytes.
242+
*/
243+
__bss_end = ALIGN(4);
244+
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
245+
246+
#include <zephyr/linker/common-noinit.ld>
247+
248248
MPU_MIN_SIZE_ALIGN
249249
/* Define linker symbols */
250250

0 commit comments

Comments
 (0)