Files
jsix/src/kernel/kernel.ld
Justin C. Miller 5ea5978ee8 [kernel] Hide kernel symbols by default
Using `-fvisibility=hidden` when building the kernel, and then
`--discard-all` when stripping it, we shave almost 100KiB off of the
resulting ELF file.

Also dropped some unused symbols from the linker script, and rearranged
the sections so that the file is able to be mapped directly into memory
instead of having each section copied.
2023-01-29 20:27:21 -08:00

60 lines
913 B
Plaintext
Executable File

PHDRS
{
rodata PT_LOAD PHDRS FILEHDR FLAGS (4) /* read-only */;
text PT_LOAD ;
rwdata PT_LOAD ;
bss PT_LOAD ;
}
MEMORY
{
kernel (rwxa) : ORIGIN = 0xFFFF800000000000, LENGTH = 256M
}
ENTRY(_kernel_start.real)
SECTIONS
{
.header ORIGIN(kernel) + SIZEOF_HEADERS : {
HIDDEN(__header_start = .);
KEEP(*(.header))
HIDDEN(__header_end = .);
} :rodata
.rodata : {
*(.rodata*)
} :rodata
.ap_startup : {
*(.ap_startup*)
} :rodata
.ctors ALIGN(8) : {
HIDDEN(__ctors = .);
KEEP(*(.ctors))
KEEP(*(.init_array))
HIDDEN(__ctors_end = .);
} :rodata
.text ALIGN(4K) : {
*(.text*)
KEEP(*(.isrs))
} :text
.data ALIGN(4K) : {
*(.data*)
} :rwdata
.syscall_registry : {
*(.syscall_registry*)
} :rwdata
.bss ALIGN(4K) : {
HIDDEN(__bss_start = .);
*(.bss*)
HIDDEN(__bss_end = .);
} :bss
HIDDEN(__kernel_end = ALIGN(4096));
}