compiler: Add missing sections to kernel linker script

This caused sporadic LoadFaults with LLD 14 and above, as they
happened to lay out the (not otherwise mentioned) GOT/PLT such
that they would overlap with the stack guard page.

LLD does support the --orphan-handling=error option, which
would be useful to avoid similar problems in the future, but
then we'd need to mention all the other misc sections
(symbol table, comments) in the linker script as well.

GitHub: Fixes #1975.
pull/2127/head
David Nadlinger 2022-11-24 16:57:31 +00:00 committed by Sebastien Bourdeauducq
parent 079d57b54d
commit 75d75cc13c
1 changed files with 15 additions and 1 deletions

View File

@ -33,9 +33,19 @@ SECTIONS
KEEP(*(.eh_frame_hdr))
} : text : eh_frame
.got :
{
*(.got)
} : text
.got.plt :
{
*(.got.plt)
} : text
.data :
{
*(.data)
*(.data .data.*)
} : data
.dynamic :
@ -51,6 +61,10 @@ SECTIONS
_end = .;
}
/* Kernel stack grows downward from end of memory, so put guard page after
* all the program contents. Note: This requires all loaded sections (at
* least those accessed) to be explicitly listed in the above!
*/
. = ALIGN(0x1000);
_sstack_guard = .;
}