From c2f48fb5df0981df1df23de2b277274f9fe75080 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 8 Jan 2024 22:28:41 -0500 Subject: first commit --- kernel/link.ld | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 kernel/link.ld (limited to 'kernel/link.ld') diff --git a/kernel/link.ld b/kernel/link.ld new file mode 100644 index 0000000..884e633 --- /dev/null +++ b/kernel/link.ld @@ -0,0 +1,47 @@ +OUTPUT_FORMAT(elf64-x86-64) +OUTPUT_ARCH(i386:x86-64) + +ENTRY(entry) + +PHDRS { + rx PT_LOAD FLAGS(5); + ro PT_LOAD FLAGS(4); + rw PT_LOAD FLAGS(6); +} + +SECTIONS { + + /* see also ../documentation/memory.txt */ + . = 0xffffffffc0000000; + __kernel_rx_start = .; + + .text : { + *(.text .text.*) + } : rx + + . = ALIGN(4096); + __kernel_rx_end = .; + __kernel_ro_start = .; + + .rodata : { + *(.rodata .rodata.*) + } : ro + + . = ALIGN(4096); + __kernel_ro_end = .; + __kernel_rw_start = .; + + .data : { + *(.data .data.*) + } : rw + + . = ALIGN(4096); + .bss : { + *(.bss .bss.*) + *(COMMON) + } : rw + + . = ALIGN(4096); + __kernel_rw_end = .; + +} -- cgit v1.2.3