Skip to content

Commit

Permalink
zephyr/linker: Add NOLOAD attribute to .last_ram_section
Browse files Browse the repository at this point in the history
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 <pdk@semihalf.com>
  • Loading branch information
duda-patryk authored and fabiobaltieri committed Jul 5, 2023
1 parent c7627ca commit b25dc41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/zephyr/linker/ram-end.ld
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* end-of-used-memory symbols
*/

SECTION_PROLOGUE(.last_ram_section,,)
SECTION_PROLOGUE(.last_ram_section, (NOLOAD),)
{
#ifdef LAST_RAM_ALIGN
LAST_RAM_ALIGN
Expand Down

0 comments on commit b25dc41

Please sign in to comment.