LLD can not catch a memory area overflow when using a data command.
If we have the script below:
.foo :
{
*(.foo)
BYTE(0x1)
} > ramwhere BYTE overflows the ram region, we do not report it currently.
Patch fixes that. This change can also be helpful for other places,
I am planning to use it for fixing PR36535.
nit: please format in the same way as other linker scripts. I.e.
MEMORY { text (rwx): org = 0x0, len = 0x1000 ram (rwx): org = 0x1000, len = 8 } SECTIONS { .text : { *(.text) } > text .foo : { *(.foo) BYTE(0x1) } > ram }