summaryrefslogtreecommitdiff
path: root/website-kernel/arch/linker.ld
diff options
context:
space:
mode:
authorNathan Lee <me@nwlee.tech>2026-09-25 23:24:31 -0500
committerNathan Lee <me@nwlee.tech>2026-09-25 23:24:31 -0500
commit548905a86473101325540446f35ffda8acd0c3bb (patch)
tree57e495fbdb302d83880bd36e7368cdb48cd23e25 /website-kernel/arch/linker.ld
parent6858c9e7c97f772eb357e3eee0c1fcfb8adcb699 (diff)
scaffold kernel from parts of wkern x86
Diffstat (limited to 'website-kernel/arch/linker.ld')
-rw-r--r--website-kernel/arch/linker.ld52
1 files changed, 52 insertions, 0 deletions
diff --git a/website-kernel/arch/linker.ld b/website-kernel/arch/linker.ld
new file mode 100644
index 0000000..52a3a05
--- /dev/null
+++ b/website-kernel/arch/linker.ld
@@ -0,0 +1,52 @@
+OUTPUT_ARCH(riscv)
+ENTRY(_start)
+
+MEMORY
+{
+ ROM (rx) : ORIGIN = 0x80000000, LENGTH = 1M
+ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 4M
+}
+
+SECTIONS
+{
+ .text : {
+ KEEP(*(.text._start))
+ KEEP(*(.text.start))
+ *(.text)
+ *(.text.*)
+ } > ROM
+ .rodata : {
+ *(.rodata)
+ *(.rodata.*)
+ } > ROM
+
+ .init_array : {
+ __init_array_start = .;
+ KEEP(*(.init_array))
+ KEEP(*(.init_array.*))
+ __init_array_end = .;
+ } > ROM
+
+ .data : {
+ __data_start = .;
+ *(.data)
+ *(.data.*)
+ __data_end = .;
+ } > RAM AT> ROM
+ __data_load = LOADADDR(.data);
+
+ .bss : {
+ __bss_start = .;
+ *(.bss)
+ *(.bss.*)
+ *(COMMON)
+ __bss_end = .;
+ } > RAM
+
+ .stack (NOLOAD) : {
+ . = ALIGN(16);
+ __stack_bottom = .;
+ . += 8K;
+ __stack_top = .;
+ } > RAM
+}