2023-03-30 16:43:04 -05:00
|
|
|
/* Tell the linker that we want an x86_64 ELF64 output file */
|
|
|
|
OUTPUT_FORMAT(elf64-x86-64)
|
|
|
|
OUTPUT_ARCH(i386:x86-64)
|
|
|
|
|
|
|
|
ENTRY(_kernel_start)
|
|
|
|
|
|
|
|
/* Define the program headers we want so the bootloader gives us the right */
|
|
|
|
/* MMU permissions */
|
|
|
|
PHDRS
|
|
|
|
{
|
|
|
|
null PT_NULL FLAGS(0) ; /* Null segment */
|
|
|
|
text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */
|
|
|
|
rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */
|
|
|
|
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
/* We wanna be placed in the topmost 2GiB of the address space, for optimisations */
|
|
|
|
/* and because that is what the Limine spec mandates. */
|
|
|
|
/* Any address in this region will do, but often 0xffffffff80000000 is chosen as */
|
|
|
|
/* that is the beginning of the region. */
|
|
|
|
. = 0xffffffff80000000;
|
|
|
|
|
|
|
|
.text : {
|
|
|
|
*(.text .text.*)
|
|
|
|
} :text
|
|
|
|
|
|
|
|
/* Align .rodata to page boundary */
|
|
|
|
. = ALIGN(4K);
|
|
|
|
|
|
|
|
.rodata : {
|
|
|
|
*(.rodata .rodata.*)
|
|
|
|
} :rodata
|
|
|
|
|
|
|
|
/* Align .data to page boundary */
|
|
|
|
. = ALIGN(4K);
|
|
|
|
|
|
|
|
.data : {
|
|
|
|
*(.data .data.*)
|
2024-11-16 10:34:45 -06:00
|
|
|
*(.got .got.*)
|
2023-03-30 16:43:04 -05:00
|
|
|
} :data
|
2024-11-23 18:21:39 -06:00
|
|
|
|
|
|
|
/* Add the .ktest section for test functions */
|
|
|
|
.note.ktest : {
|
|
|
|
__ktest_start = .; /* Mark the beginning of the section */
|
|
|
|
*(.note.ktest) /* Include all items in the .ktest section */
|
|
|
|
__ktest_end = .; /* Mark the end of the section */
|
|
|
|
}
|
2023-03-30 16:43:04 -05:00
|
|
|
|
|
|
|
.bss : {
|
|
|
|
*(COMMON)
|
|
|
|
*(.bss .bss.*)
|
|
|
|
|
|
|
|
/* Align initial kernel heap to page boundary */
|
|
|
|
. = ALIGN(4K);
|
|
|
|
PROVIDE(_initial_kernel_heap_start = .);
|
2023-05-15 02:19:34 -05:00
|
|
|
/* PROVIDE(_initial_kernel_heap_size = 1024 * 1024); */
|
2023-07-12 12:21:31 -05:00
|
|
|
PROVIDE(_initial_kernel_heap_size = 1024 * 4096 * 100);
|
2023-03-30 16:43:04 -05:00
|
|
|
. += _initial_kernel_heap_size;
|
|
|
|
} :data
|
|
|
|
}
|