]> git.dujemihanovic.xyz Git - nameless-os.git/blobdiff - kernel/linker.ld
kernel: Remove LMAs from linker script
[nameless-os.git] / kernel / linker.ld
index 645a82421029a638d8ea58a86e8282852af09936..73fd822e18f1981778f897955a3ff9f149b00504 100644 (file)
@@ -1,16 +1,21 @@
 ENTRY(_start)
-OUTPUT_FORMAT(binary)
 
 SECTIONS
 {
-       . = 0x100000;
+       . = 0xc0000000;
        __KERNEL_BASE__ = .;
 
-       .text : ALIGN(4K) { 
-               kernel/entry.o (.text)
-               *(.text) 
+       .text : ALIGN(4K) {
+               __TEXT_BASE__ = .;
+               entry.o (.text)
+               *(.text)
+               __TEXT_END__ = .;
+       }
+       .rodata : ALIGN(4K) {
+               __RODATA_BASE__ = .;
+               *(.rodata)
+               __RODATA_END__ = .;
        }
-       .rodata : ALIGN(4K) { *(.rodata) }
 
        /* .rodata is put after .text so that the read-only entry in the program
         * header covers .rodata as well. When .rodata is after .data, that entry
@@ -21,12 +26,18 @@ SECTIONS
         * matter yet because we (currently) assume that the NX bit is not
         * supported anyway. */
 
-       .data : ALIGN(4K) { *(.data) }
-       .bss : ALIGN(4K) { 
+       .data : ALIGN(4K) {
+               __DATA_BASE__ = .;
+               *(.data)
+               __DATA_END__ = .;
+       }
+       .bss : ALIGN(4K) {
+               __BSS_BASE__ = .;
                *(.bss)
                /* Reserving 16KiB for the stack. A __STACK_TOP__ is not really
                 * needed (yet). */
-               . += 16K; 
+               . += 16K;
                __STACK_BOTTOM__ = .;
+               __BSS_END__ = .;
        }
 }