I have the following linker script:
.data & .bss are placed into ram, then a .heap section fills the remaining memory.
Now I want to add a .noinit section that always gets placed at the end of the memory. That is so it gets ignored by bootloaders and the like.
I still want my .heap section to occupy all available space between .bss and .noinit, but for this I need to know the size of the .noinit section.
A naive approach failed:
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
    . = ALIGN(4);
    _sbss = . ;
    _szero = .;
    *(.bss .bss.*)
    *(COMMON)
    . = ALIGN(4);
    _ebss = . ;
    _ezero = .;
} > ram
/* heap section */
.heap (NOLOAD) :
{
    . = ALIGN(4);
    _sheap = . ;
    . = ORIGIN(ram) + LENGTH(ram) - SIZEOF(.noinit);
    _eheap = . ;
}  > ram
/*
 * collect all uninitialized sections that go into RAM
 */
.noinit (NOLOAD) :
{
    . = ALIGN(4);
    __noinit_start = .;
    *(.noinit)
    __noinit_end = .;
}  > ram
Here SIZEOF(.noinit) is always 0 because the section is defined after that statement.
But in fact what I want is SIZEOF(*(.noinit)) - however this is a syntax error.
So how do I get the size of an input section without placing it into an output section first?
 
     
    