Skip to content

Commit b25dc41

Browse files
duda-patrykfabiobaltieri
authored andcommitted
zephyr/linker: Add NOLOAD attribute to .last_ram_section
Currently, this section has LOAD flag which means that it's part of image layout. Attempt to generate binary file with --gap-fill results in creating a very big file, because LMA of the section is RAM address (e.g. 0x20000000 for STM32F4) instead of FLASH (e.g. 0x8000000 for STM32F4). This problem doesn't appear when linking using GNU LD, because it removes the section in garbage collect process. However, LLVM LLD doesn't garbage collect sections that define used symbols, so the section is present in final ELF image. There is no need to load this section (it has 0 size), so we can safely add NOLOAD attribute to the section. Fixes: #57727 Signed-off-by: Patryk Duda <[email protected]>
1 parent c7627ca commit b25dc41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/zephyr/linker/ram-end.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* end-of-used-memory symbols
44
*/
55

6-
SECTION_PROLOGUE(.last_ram_section,,)
6+
SECTION_PROLOGUE(.last_ram_section, (NOLOAD),)
77
{
88
#ifdef LAST_RAM_ALIGN
99
LAST_RAM_ALIGN

0 commit comments

Comments
 (0)