summaryrefslogtreecommitdiff
path: root/kernel/link.ld
diff options
context:
space:
mode:
authorVaze <vaze@vaze.dev>2026-05-27 13:18:52 +0200
committerVaze <vaze@vaze.dev>2026-05-27 13:18:52 +0200
commit407d34ca790ea224c79e17a5cbe33976bf02a6fc (patch)
tree19aa48b8e6a3c5c5d38e20f2696948a093f8e695 /kernel/link.ld
parent816f9b7cb300a7f3979b5f29b3677e84a3c28880 (diff)
Removed bootloader sub-project. ZenOS will focus on the kernel from now on. BOOTBOOT will be used as the only supported bootloader for now. Development of a custom bootloader might resume at a much later date.HEADmaster
Diffstat (limited to 'kernel/link.ld')
-rw-r--r--kernel/link.ld54
1 files changed, 54 insertions, 0 deletions
diff --git a/kernel/link.ld b/kernel/link.ld
new file mode 100644
index 0000000..b61cd01
--- /dev/null
+++ b/kernel/link.ld
@@ -0,0 +1,54 @@
+OUTPUT_FORMAT(elf64-x86-64)
+ENTRY(_start)
+
+KERNEL_BASE = 0xffffffff80000000;
+
+PHDRS
+{
+ text PT_LOAD;
+ rodata PT_LOAD;
+ data PT_LOAD;
+}
+
+SECTIONS
+{
+ . = KERNEL_BASE;
+ .text : {
+ *(.text .text.*)
+ } : text
+
+ . = ALIGN(CONSTANT(MAXPAGESIZE));
+
+ .rodata : {
+ *(.rodata .rodata.*)
+ } :rodata
+
+ /* Add a .note.gnu.build-id output section in case a build ID flag is added to the */
+ /* linker command. */
+ .note.gnu.build-id : {
+ *(.note.gnu.build-id)
+ } :rodata
+
+ /* Move to the next memory page for .data */
+ . = ALIGN(CONSTANT(MAXPAGESIZE));
+
+ .data : {
+ *(.data .data.*)
+ } :data
+
+ /* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */
+ /* unnecessary zeros will be written to the binary. */
+ /* If you need, for example, .init_array and .fini_array, those should be placed */
+ /* above this. */
+ .bss : {
+ *(.bss .bss.*)
+ *(COMMON)
+ } :data
+
+ /* Discard .note.* and .eh_frame* since they may cause issues on some hosts. */
+ /DISCARD/ : {
+ *(.eh_frame*)
+ *(.note .note.*)
+ }
+}
+