Files
XunilOS/kernel/linker-aarch64.ld
T
csd4ni3l 812d4cf6d4 Patched everything for aarch64, aside from scheduler, add more linker
points to aarch64 ld, add aarch64 heap, init, page tables and usermode,
make hhdm_offset a global atomic, aarch64 uses semihosting for output,
add generic PageTable type, add a function that creates and maps pages,
use allow to remove warnings, add a bufwriter so kernel panic always
works
2026-05-16 00:30:01 +02:00

56 lines
1.4 KiB
Plaintext

/* Tell the linker that we want an aarch64 ELF64 output file */
OUTPUT_FORMAT(elf64-littleaarch64)
/* We want the symbol kmain to be our entry point */
ENTRY(kmain)
/* Define the program headers we want so the bootloader gives us the right */
/* MMU permissions; this also allows us to exert more control over the linking */
/* process. */
PHDRS
{
text PT_LOAD;
rodata PT_LOAD;
data PT_LOAD;
}
SECTIONS
{
/* We want to 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;
__kernel_start = .;
__text_start = .;
.text : { *(.text .text.*) } :text
. = ALIGN(CONSTANT(MAXPAGESIZE));
__text_end = .;
__rodata_start = .;
.rodata : { *(.rodata .rodata.*) } :rodata
. = ALIGN(CONSTANT(MAXPAGESIZE));
__rodata_end = .;
__data_start = .;
.data : {
*(.data .data.*)
KEEP(*(.requests_start_marker))
KEEP(*(.requests))
KEEP(*(.requests_end_marker))
} :data
.bss : {
*(.bss .bss.*)
*(COMMON)
} :data
__data_end = .;
__kernel_end = .;
/* Discard .note.* and .eh_frame* since they may cause issues on some hosts. */
/DISCARD/ : {
*(.eh_frame*)
*(.note .note.*)
}
}