This behavior matches GNU ld and seems reasonable.
// If a SECTIONS command is not specified .text.* -> .text .rodata.* -> .rodata .init_array.* -> .init_array
A proposed Linux feature CONFIG_FG_KASLR may depend on the GNU ld behavior.
Reword a comment about -z keep-text-section-prefix.
2 questions regarding the current code.
if (script->hasSectionsCommand) { // CommonSection is identified as "COMMON" in linker scripts. // By default, it should go to .bss section. if (s->name == "COMMON") return ".bss"; return s->name; } // When no SECTIONS is specified, emulate GNU ld's internal linker scripts... <code>