52ce3eb6c2d9147951751f3c9a4bfc37d7f045d0
[lunaix-os.git] / lunaix-os / link / linker.ld
1 ENTRY(start_)
2
3 SECTIONS {
4     . = 0x100000;
5
6     /* 这里是我们的高半核初始化代码段和数据段 */
7     .boot.text BLOCK(4K) : {
8         *(.multiboot)
9         *(.boot.text)
10     }
11
12     .boot.bss BLOCK(4K) : {
13         *(.boot.bss)
14     }
15
16     .boot.data BLOCK(4K) : {
17         *(.boot.data)
18     }
19
20     .boot.rodata BLOCK(4K) : {
21         *(.boot.rodata)
22     }
23
24     .boot.bss BLOCK(4K) : {
25         *(.boot.rodata)
26     }
27     __kexec_boot_end = ALIGN(4K);
28
29     /* ---- boot end ---- */
30
31     /* ---- kernel start ---- */
32
33     . += 0xC0000000;
34
35     /* 好了,我们的内核…… */
36     .text BLOCK(4K) : AT ( ADDR(.text) - 0xC0000000 ) {
37         __kexec_start = .;
38         PROVIDE(__kexec_text_start = .);
39         
40         *(.text)
41
42         PROVIDE(__kexec_text_end = .);
43     }
44
45     .data BLOCK(4K) : AT ( ADDR(.data) - 0xC0000000 ) {
46         *(.data)
47     }
48
49     .rodata BLOCK(4K) : AT ( ADDR(.rodata) - 0xC0000000 ) {
50         *(.rodata)
51     }
52
53     .kpg BLOCK(4K) : AT ( ADDR(.kpg) - 0xC0000000 ) {
54         *(.kpg)
55     }
56
57     . = ALIGN(4K);
58
59     /* for generated array, we align to address line size */
60
61     .lga BLOCK(4K) : AT ( ADDR(.lga) - 0xC0000000 ) {
62         PROVIDE(__lga_twiplugin_inits_start = .);
63         
64         KEEP(*(.lga.twiplugin_inits));
65
66         PROVIDE(__lga_twiplugin_inits_end = .);
67
68         /* ---- */
69
70         /* align to 8 bytes, so it can cover both 32 and 64 bits address line*/
71         . = ALIGN(8);
72
73         PROVIDE(__lga_pci_dev_drivers_start = .);
74         
75         KEEP(*(.lga.pci_dev_drivers));
76
77         PROVIDE(__lga_pci_dev_drivers_end = .);
78
79         /* ---- */
80
81         . = ALIGN(8);
82
83         PROVIDE(__lga_rtcdev_start = .);
84         
85         KEEP(*(.lga.rtcdev));
86
87         PROVIDE(__lga_rtcdev_end = .);
88
89         /* ---- */
90
91         . = ALIGN(8);
92
93         PROVIDE(__lga_inputdev_start = .);
94         
95         KEEP(*(.lga.inputdev));
96
97         PROVIDE(__lga_inputdev_end = .);
98
99         /* ---- */
100
101         . = ALIGN(8);
102
103         PROVIDE(__lga_pseudo_dev_start = .);
104         
105         KEEP(*(.lga.pseudo_dev));
106
107         PROVIDE(__lga_pseudo_dev_end = .);
108     }
109
110     .bss BLOCK(4K) : AT ( ADDR(.bss) - 0xC0000000 ) {
111         *(.bss)
112     }
113
114     __kexec_end = ALIGN(4K);
115 }