]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kernel.ia32.ld
09b49d4a521bd1c12d4e293e733200bba59fc217
[l4.git] / kernel / fiasco / src / kernel.ia32.ld
1 /* -*- c -*- */
2
3 #include "globalconfig.h"
4 #include "linking.h"
5
6 _boot_sys_start = 0x300000;
7 _kernel_image   = FIASCO_IMAGE_VIRT_START;      /* kernel link address */
8 _load           = FIASCO_IMAGE_PHYS_START & 0x3fffff;
9 /*
10 _load           = 0x1000;       /* skip page 0 to preserve BIOS data and
11                                  * page 1 to reserve space for the KIP */
12
13 /*_fiasco_image_offset = 0xf0000000;*/
14 _fiasco_image_offset = FIASCO_IMAGE_PHYS_OFFSET;
15
16 ENTRY(bootstrap__boot_start)
17
18 PHDRS {
19   tramp PT_LOAD;
20   btext PT_LOAD;
21   bdata PT_LOAD;
22   kip PT_LOAD;
23   ktext PT_LOAD;
24   kdata PT_LOAD;
25   kitext PT_LOAD;
26   kidata PT_LOAD;
27 }
28
29 SECTIONS {
30   . = FIASCO_MP_TRAMP_PAGE;
31   .mp_tramp : {
32       KEEP(*(.mp_tramp))
33       . = ALIGN(0x1000);
34   } : tramp
35
36   . = _boot_sys_start;
37   .text_boot : ALIGN(0x1000) {
38     *(.bootstrap.text .bootstrap.text.* .bootstrap.gnu.linkonce.t.*)
39   } : btext
40   
41   . = ALIGN(0x10);
42   .bss_boot : {
43     *(.bootstrap.bss)
44   . = ALIGN(0x1000);
45   PROVIDE(_boot_sys_end = .);
46   } : bdata
47
48   . = _kernel_image + _load;
49
50   .kip : AT(ADDR(.kip) - _fiasco_image_offset) {
51     _kernel_image_start = .;
52     *(.kernel_info_page)
53     _initkip_start = .;
54     KEEP(*(.initkip.version))
55     KEEP(*(.initkip.features))
56     KEEP(*(.initkip.features.fini))
57     _initkip_end = .;
58     . = ALIGN(4K);
59   } : kip = 0
60
61 #ifdef CONFIG_ALLOW_RO_TEXT
62   . = ALIGN(4K);
63 #endif
64   .text : AT (ADDR(.text) - _fiasco_image_offset) {
65     PROVIDE ( _kernel_text_start = . );
66     crt0.o(.text)
67     *(.init)
68     *(.text SORT(.text.*) .gnu.linkonce.t.*)
69     *(.fini)
70
71     PROVIDE (_ecode = .);
72
73     *(.rodata .rodata.* .gnu.linkonce.r.*)
74
75     . = ALIGN(4);
76     PROVIDE (_log_table = .);
77     /*
78      * The section must start with ".debug" because else the linker
79      * complains about references to discarded sections
80      */
81     KEEP(*(SORT(.debug.jdb.log_table)))
82     PROVIDE (_log_table_end = .);
83
84     . = ALIGN(0x40);
85
86     PROVIDE (_etext = .);
87   } : ktext = 0x90909090
88
89 #ifdef CONFIG_ALLOW_RO_TEXT
90   . = ALIGN(4K);
91 #else
92   . = ALIGN(0x10);
93 #endif
94   .data : AT (ADDR(.data) - _fiasco_image_offset) {
95     PROVIDE (_kernel_data_start = .);
96     *(.data .data.* .gnu.linkonce.d.*)
97     *(.anno)
98
99     /* Constructor and destructor lists, ordered by priority.  The lists
100        are traversed from end to start, therefore the *_END__ symbols
101        precede the *_LIST__ symbols. */
102
103     __PER_CPU_CTORS_END__ = .;
104     KEEP (*(.ctors.00010))
105     KEEP (*(.ctors.00009))
106     KEEP (*(.ctors.00008))
107     KEEP (*(.ctors.00007))
108     KEEP (*(.ctors.00006))
109     KEEP (*(.ctors.00005))
110     KEEP (*(.ctors.00004))
111     KEEP (*(.ctors.00003))
112     KEEP (*(.ctors.00002))
113     KEEP (*(.ctors.00001))
114     __PER_CPU_CTORS_LIST__ = .;
115
116     __CTOR_END__ = .;
117     CONSTRUCTORS
118     KEEP (*(.ctors))
119     KEEP (*(SORT (.ctors.*)))
120     __CTOR_LIST__ = .;
121
122     __DTOR_END__ = .;    
123     KEEP (*(SORT (.dtors.*)))
124     KEEP (*(.dtors))
125     __DTOR_LIST__ = .;
126
127     PROVIDE (_edata = .);
128   } : kdata
129
130   . = ALIGN(8);
131   .per_cpu_data : AT (ADDR(.per_cpu_data) - _fiasco_image_offset) {
132     PROVIDE (_per_cpu_data_start = .);
133     *(.per_cpu.data)
134     . = ALIGN(8);
135     PROVIDE (_per_cpu_data_end = .);
136   } : kdata
137
138   . = ALIGN(0x10);
139   .bss : AT (ADDR(.bss) - _fiasco_image_offset) {
140     PROVIDE (_bss_start = .);
141     *(.bss .bss.* .gnu.linkonce.b.* COMMON)
142     PROVIDE (_bss_end = .);
143   } : kdata
144
145   PROVIDE (_end = .);
146
147   . = ALIGN(4096);
148   PROVIDE (_initcall_start = .);
149   .initcall.text : AT (ADDR(.initcall.text) - _fiasco_image_offset) {
150     *(.initcall.text*)
151   } : kitext = 0x90909090
152
153   .initcall.data : AT (ADDR(.initcall.data) - _fiasco_image_offset) {
154     *(.initcall.data*)
155     . = ALIGN(4096);
156     PROVIDE (_initcall_end = .);
157   } : kidata
158
159   /DISCARD/ : {
160     *(.note)
161     *(.note.ABI-tag)
162     *(.comment)
163     *(.eh_frame)
164   }
165 }