summaryrefslogtreecommitdiff
path: root/kernel/link.ld
diff options
context:
space:
mode:
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 = .;
+
+}