That is correct; the loader uses no BSS DATA or COMMON, but I added your suggestion anyway
/* KDE_loader.o - goes ===LAST=== in the boot block, because the location pointer
is now pointing into RAM_L. You can check the boot block code usage by checking
_loader_end_in_flash in the .map file.
The address specified below is not actually needed but if you don't specify it, the
loader gets loaded into RAM at 0x20000000 which is fine except that it craps over
some globals set up by previous code e.g. systemcoreclock */
. = ALIGN(4);
_loader_loadaddr = .; /* this is where the loader start is in FLASH */
.KDE_loader.o 0x20018000 : /* this is where the loader start is in RAM */
{
. = ALIGN(4);
_loader_start = .;
KEEP(*(.KDE_loader.o))
*KDE_loader.o (.text .text* .rodata .rodata* .data .data*)
. = ALIGN(4);
_loader_end = .;
} >RAM_L AT>FLASH_BOOT
/* These variables are not necessarily used but can be inspected in the .map file */
_loader_size = _loader_end - _loader_start;
_loader_end_in_flash = _loader_loadaddr + _loader_size;
/* Place loader BSS right after the loader code, in RAM. */
loader_bss _loader_end :
{
. = ALIGN(4);
_loader_bss_start = .;
*KDE_loader.o(.bss*)
. = ALIGN(4);
_loader_bss_end = .;
} >RAM_L
I established, with careful testing, that with this compiler you get:
With ARM GCC, statics are categorised thus:
int fred=0; goes into BSS (which by definition is zeroed by startup code)
int fred; goes into COMMON
int fred=1; goes into DATA (statics initialised to nonzero)
HOWEVER I have just tested for the overlap and
still get the overlap error... so back to square one after all that

c:\st\stm32cubeide_1.4.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\bin\ld.exe: section .KDE_loader.o VMA [0000000020018000,00000000200186ff] overlaps section .bss VMA [0000000020000eb0,000000002001dc3f]
It seems that if I don't specify the 0x20018000, there is no overlap detection, which is interesting. The loader then runs from 0x20000000 but has crapped over an statics configured by previous code. I can work around that. I suspect this is how the avoidance of overlap errors was actually achieved by those who did it previously.
So next I tried removing the address and defining it in MEMORY as RAM_L of the appropriate size:
MEMORY
{
FLASH_BOOT (rx) : ORIGIN = 0x08000000, LENGTH = 32K
FLASH_APP (rx) : ORIGIN = 0x08008000, LENGTH = 1024K-32K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
RAM_L (xrw) : ORIGIN = 0x20018000, LENGTH = 32K
MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
}Nope, doesn't work. Same overlap error. This is what I am using to do the overlap test:
uint8_t fred1234[62000];Fred1234 is correctly in COMMON

even though the LD error talks about BSS. Examining the .map file shows that they have BSS+COMMON as one single block so this makes sense.
This issue is clearly more subtle, because having the loader at base of RAM, and having it crap all over bss, common and data also there, doesn't generate an error, while defining a big fred1234[] in main.c as above does get detected.
For amusement, I also found that
*KDE_loader.o (.text .text* .rodata .rodata* .data .data*)placed DATA
before TEXT in memory. That doesn't actually matter (because control is transferred to the loader by calling a function, not a fixed address) but it is daft.