This is PR32351
Each output section may have a type. The type is a keyword in parentheses. The following types are defined:
NOLOAD
The section should be marked as not loadable, so that it will not be loaded into memory when the program is run.
(https://sourceware.org/binutils/docs/ld/Output-Section-Type.html#Output-Section-Type)
Parch makes such sections to be SHT_NOBITS. That looks consistent with what BFD do. Gold do something different now,
what looks like a wrong implementation simply.
Use case is next (taken from https://mcuoneclipse.com/2014/04/19/gnu-linker-can-you-not-initialize-my-variable/):
- We want to place variable at absolute address and use next code:
static unsigned char Var[4096] __attribute__((section (".data_noload_a")));
- Our script looks like:
.data_noload_a 0x2000000 : { *(.data_noload_a) }
Problem is that Var will stop be SHT_NOBITS and became SHT_PROGBITS.
(if attribute used with section, the variable is treated like an initialized variable, see article above)
We may want to save space, and do not write 4096 of zeroes to output file. NOLOAD is a solution.
NOLOAD forces output section to be SHT_NOBITS.