a409542624fbe546ab7907b7d4840a1c6f25b391
[lunaix-os.git] / lunaix-os / link / linker.ld
1 ENTRY(start_)
2
3 SECTIONS {
4     . = 0x100000;
5
6     /* 这里是我们的高半核初始化代码段和数据段 */
7     .boot.text BLOCK(4K) : 
8     {
9         *(.multiboot)
10         *(.boot.text)
11     }
12
13     .boot.bss BLOCK(4K) : 
14     {
15         *(.boot.bss)
16     }
17
18     .boot.data BLOCK(4K) : 
19     {
20         *(.boot.data)
21     }
22
23     .boot.rodata BLOCK(4K) : 
24     {
25         *(.boot.rodata)
26     }
27
28     .boot.bss BLOCK(4K) : 
29     {
30         *(.boot.rodata)
31     }
32     __kexec_boot_end = ALIGN(4K);
33
34     /* ---- boot end ---- */
35
36     /* ---- kernel start ---- */
37
38     . += 0xC0000000;
39
40     /* 好了,我们的内核…… */
41     
42     PROVIDE(__kexec_text_start = ALIGN(4K));
43     
44     .text BLOCK(4K) : AT ( ADDR(.text) - 0xC0000000 ) 
45     {
46         __kexec_start = .;
47         
48         *(.text)
49     }
50
51     .kf.preempt BLOCK(4K) : AT ( ADDR(.kf.preempt) - 0xC0000000 ) 
52     {
53         PROVIDE(__kf_preempt_start = .);
54         
55         KEEP(*(.kf.preempt));
56
57         PROVIDE(__kf_preempt_end = .);
58     }
59
60     PROVIDE(__kexec_text_end = .);
61
62     .data BLOCK(4K) : AT ( ADDR(.data) - 0xC0000000 ) 
63     {
64         *(.data)
65     }
66
67     .rodata BLOCK(4K) : AT ( ADDR(.rodata) - 0xC0000000 ) 
68     {
69         *(.rodata)
70     }
71
72     .kpg BLOCK(4K) : AT ( ADDR(.kpg) - 0xC0000000 ) 
73     {
74         *(.kpg)
75     }
76
77     . = ALIGN(4K);
78
79     /* for generated array, we align to address line size */
80
81     .lga BLOCK(4K) : AT ( ADDR(.lga) - 0xC0000000 ) 
82     {
83         PROVIDE(__lga_twiplugin_inits_start = .);
84         
85         KEEP(*(.lga.twiplugin_inits));
86
87         PROVIDE(__lga_twiplugin_inits_end = .);
88
89         /* ---- */
90
91         /* align to 8 bytes, so it can cover both 32 and 64 bits address line*/
92         . = ALIGN(8);
93
94         PROVIDE(__lga_devdefs_start = .);
95         
96         KEEP(*(.lga.devdefs));
97
98         PROVIDE(__lga_devdefs_end = .);
99
100         /* ---- */
101
102         . = ALIGN(8);
103
104         PROVIDE(__lga_dev_ld_kboot_start = .);
105         
106         KEEP(*(.lga.devdefs.ld_kboot));
107
108         PROVIDE(__lga_dev_ld_kboot_end = .);
109
110         /* ---- */
111
112         . = ALIGN(8);
113
114         PROVIDE(__lga_dev_ld_sysconf_start = .);
115         
116         KEEP(*(.lga.devdefs.ld_sysconf));
117
118         PROVIDE(__lga_dev_ld_sysconf_end = .);
119
120         /* ---- */
121
122         . = ALIGN(8);
123
124         PROVIDE(__lga_dev_ld_timedev_start = .);
125         
126         KEEP(*(.lga.devdefs.ld_timedev));
127
128         PROVIDE(__lga_dev_ld_timedev_end = .);
129
130         /* ---- */
131
132         . = ALIGN(8);
133
134         PROVIDE(__lga_dev_ld_post_start = .);
135         
136         KEEP(*(.lga.devdefs.ld_post));
137
138         PROVIDE(__lga_dev_ld_post_end = .);
139
140         /* ---- */
141
142         . = ALIGN(8);
143
144         PROVIDE(__lga_fs_start = .);
145         
146         KEEP(*(.lga.fs));
147
148         PROVIDE(__lga_fs_end = .);
149
150         /* ---- */
151
152         . = ALIGN(8);
153
154         PROVIDE(__lga_lunainit_on_earlyboot_start = .);
155         
156         KEEP(*(.lga.lunainit.c_earlyboot));
157
158         PROVIDE(__lga_lunainit_on_earlyboot_end = .);
159
160         /* ---- */
161
162         . = ALIGN(8);
163
164         PROVIDE(__lga_lunainit_on_boot_start = .);
165         
166         KEEP(*(.lga.lunainit.c_boot));
167
168         PROVIDE(__lga_lunainit_on_boot_end = .);
169
170         /* ---- */
171
172         . = ALIGN(8);
173
174         PROVIDE(__lga_lunainit_on_postboot_start = .);
175         
176         KEEP(*(.lga.lunainit.c_postboot));
177
178         PROVIDE(__lga_lunainit_on_postboot_end = .);
179
180     }
181
182     .bss BLOCK(4K) : AT ( ADDR(.bss) - 0xC0000000 ) 
183     {
184         *(.bss)
185     }
186
187     __kexec_end = ALIGN(4K);
188 }