2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-18 16:06:30 +08:00

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.
This commit is contained in:
David Nadlinger 2022-11-24 16:57:31 +00:00 committed by Sebastien Bourdeauducq
parent 079d57b54d
commit 75d75cc13c

View File

@ -33,9 +33,19 @@ SECTIONS
KEEP(*(.eh_frame_hdr)) KEEP(*(.eh_frame_hdr))
} : text : eh_frame } : text : eh_frame
.got :
{
*(.got)
} : text
.got.plt :
{
*(.got.plt)
} : text
.data : .data :
{ {
*(.data) *(.data .data.*)
} : data } : data
.dynamic : .dynamic :
@ -51,6 +61,10 @@ SECTIONS
_end = .; _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); . = ALIGN(0x1000);
_sstack_guard = .; _sstack_guard = .;
} }