refactor: one more step towards arch-agnostic design
[lunaix-os.git] / lunaix-os / link / linker.ld
index ba3a3853a232d4fb4c9bd10df8a1175f660ff367..71bc1511ff31a2cca0d01055cf866ab693aa218d 100644 (file)
@@ -11,60 +11,76 @@ SECTIONS {
     . = 0x100000;
 
     /* 这里是我们的高半核初始化代码段和数据段 */
+    .boot.text BLOCK(4K) : {
+        *(.multiboot)
+        *(.boot.text)
+    }
 
-    .hhk_init_text BLOCK(4K) : {
-        * (.multiboot)
-        build/obj/arch/x86/*.o (.hhk_init)
-        build/obj/arch/x86/*.o (.text)
+    .boot.bss BLOCK(4K) : {
+        *(.boot.bss)
     }
 
-    .hhk_init_bss BLOCK(4K) : {
-        build/obj/arch/x86/*.o (.bss)
+    .boot.data BLOCK(4K) : {
+        *(.boot.data)
     }
 
-    .hhk_init_data BLOCK(4K) : {
-        build/obj/arch/x86/*.o (.data)
+    .boot.rodata BLOCK(4K) : {
+        *(.boot.rodata)
     }
 
-    .hhk_init_rodata BLOCK(4K) : {
-        build/obj/arch/x86/*.o (.rodata)
+    .boot.bss BLOCK(4K) : {
+        *(.boot.rodata)
     }
-    __init_hhk_end = ALIGN(4K);
+    __kexec_boot_end = ALIGN(4K);
 
     /* Relocation of our higher half kernel */
     . += 0xC0000000;
 
     /* 好了,我们的内核…… */
     .text BLOCK(4K) : AT ( ADDR(.text) - 0xC0000000 ) {
-        __kernel_start = .;
-        build/obj/kernel/*.o (.text)
-        build/obj/hal/*.o (.text)
+        __kexec_start = .;
+        PROVIDE(__kexec_text_start = .);
+        
+        *(.text)
+
+        PROVIDE(__kexec_text_end = .);
     }
 
-    __usrtext_start = ALIGN(4K);
-    .usrtext BLOCK(4K) : AT ( ADDR(.usrtext) - 0xC0000000 ) {
-        build/obj/kernel/*.o (.usrtext)
+    .data BLOCK(4K) : AT ( ADDR(.data) - 0xC0000000 ) {
+        *(.data)
     }
-    __usrtext_end = ALIGN(4K);
 
-    .bss BLOCK(4K) : AT ( ADDR(.bss) - 0xC0000000 ) {
-        build/obj/kernel/*.o (.bss)
-        build/obj/hal/*.o (.bss)
+    .rodata BLOCK(4K) : AT ( ADDR(.rodata) - 0xC0000000 ) {
+        *(.rodata)
     }
 
-    .data BLOCK(4k) : AT ( ADDR(.data) - 0xC0000000 ) {
-        build/obj/kernel/*.o (.data)
-        build/obj/hal/*.o (.data)
+    .kpg BLOCK(4K) : AT ( ADDR(.kpg) - 0xC0000000 ) {
+        *(.kpg)
     }
 
-    .rodata BLOCK(4K) : AT ( ADDR(.rodata) - 0xC0000000 ) {
-        build/obj/kernel/*.o (.rodata)
-        build/obj/hal/*.o (.rodata)
+    . = ALIGN(4K);
+
+    /* for generated array, we align to address line size */
+
+    .lga BLOCK(4K) : AT ( ADDR(.lga) - 0xC0000000 ) {
+        PROVIDE(__lga_twiplugin_inits_start = .);
+        
+        KEEP(*(.lga.twiplugin_inits));
+
+        PROVIDE(__lga_twiplugin_inits_end = .);
+
+        /* ---- */
+
+        PROVIDE(__lga_pci_dev_drivers_start = .);
+        
+        KEEP(*(.lga.pci_dev_drivers));
+
+        PROVIDE(__lga_pci_dev_drivers_end = .);
     }
 
-    .kpg BLOCK(4K) : AT ( ADDR(.kpg) - 0xC0000000 ) {
-        build/obj/arch/x86/*.o (.kpg)
+    .bss BLOCK(4K) : AT ( ADDR(.bss) - 0xC0000000 ) {
+        *(.bss)
     }
 
-    __kernel_end = ALIGN(4K);
+    __kexec_end = ALIGN(4K);
 }
\ No newline at end of file