summaryrefslogtreecommitdiff
path: root/kernel/link.ld
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-01-08 22:28:41 -0500
committerBenji Dial <benji@benjidial.net>2024-01-08 22:28:41 -0500
commitc2f48fb5df0981df1df23de2b277274f9fe75080 (patch)
tree5202557438bbe3bdc7d10c7769731ab3594185f9 /kernel/link.ld
downloadhilbert-os-c2f48fb5df0981df1df23de2b277274f9fe75080.tar.gz
first commit
Diffstat (limited to 'kernel/link.ld')
-rw-r--r--kernel/link.ld47
1 files changed, 47 insertions, 0 deletions
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 = .;
+
+}