fix: corner cases when printing large content through term interface
[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_devdefs_start = .);
74         
75         KEEP(*(.lga.devdefs));
76
77         PROVIDE(__lga_devdefs_end = .);
78
79         /* ---- */
80
81         . = ALIGN(8);
82
83         PROVIDE(__lga_dev_ld_kboot_start = .);
84         
85         KEEP(*(.lga.devdefs.ld_kboot));
86
87         PROVIDE(__lga_dev_ld_kboot_end = .);
88
89         /* ---- */
90
91         . = ALIGN(8);
92
93         PROVIDE(__lga_dev_ld_sysconf_start = .);
94         
95         KEEP(*(.lga.devdefs.ld_sysconf));
96
97         PROVIDE(__lga_dev_ld_sysconf_end = .);
98
99         /* ---- */
100
101         . = ALIGN(8);
102
103         PROVIDE(__lga_dev_ld_timedev_start = .);
104         
105         KEEP(*(.lga.devdefs.ld_timedev));
106
107         PROVIDE(__lga_dev_ld_timedev_end = .);
108
109         /* ---- */
110
111         . = ALIGN(8);
112
113         PROVIDE(__lga_dev_ld_post_start = .);
114         
115         KEEP(*(.lga.devdefs.ld_post));
116
117         PROVIDE(__lga_dev_ld_post_end = .);
118
119         /* ---- */
120
121         . = ALIGN(8);
122
123         PROVIDE(__lga_fs_start = .);
124         
125         KEEP(*(.lga.fs));
126
127         PROVIDE(__lga_fs_end = .);
128
129         /* ---- */
130
131         . = ALIGN(8);
132
133         PROVIDE(__lga_lunainit_on_earlyboot_start = .);
134         
135         KEEP(*(.lga.lunainit.c_earlyboot));
136
137         PROVIDE(__lga_lunainit_on_earlyboot_end = .);
138
139         /* ---- */
140
141         . = ALIGN(8);
142
143         PROVIDE(__lga_lunainit_on_boot_start = .);
144         
145         KEEP(*(.lga.lunainit.c_boot));
146
147         PROVIDE(__lga_lunainit_on_boot_end = .);
148
149         /* ---- */
150
151         . = ALIGN(8);
152
153         PROVIDE(__lga_lunainit_on_postboot_start = .);
154         
155         KEEP(*(.lga.lunainit.c_postboot));
156
157         PROVIDE(__lga_lunainit_on_postboot_end = .);
158
159     }
160
161     .bss BLOCK(4K) : AT ( ADDR(.bss) - 0xC0000000 ) {
162         *(.bss)
163     }
164
165     __kexec_end = ALIGN(4K);
166 }