]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kernel.amd64.ld
update
[l4.git] / kernel / fiasco / src / kernel.amd64.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 & 0x1fffff;
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 OUTPUT_FORMAT("elf64-x86-64")
17 OUTPUT_ARCH(i386:x86-64)
18 ENTRY(bootstrap__boot_start)
19
20 PHDRS {
21   tramp PT_LOAD;
22   btext PT_LOAD;
23   bdata PT_LOAD;
24   kip PT_LOAD;
25   koptions PT_LOAD;
26   ktext PT_LOAD;
27   kdata PT_LOAD;
28   kitext PT_LOAD;
29   kidata PT_LOAD;
30 }
31
32 SECTIONS {
33   . = FIASCO_MP_TRAMP_PAGE;
34   .mp_tramp : {
35       KEEP(*(.mp_tramp))
36       . = ALIGN(0x1000);
37   } : tramp
38
39   . = _boot_sys_start;
40   .text_boot : ALIGN(0x1000) {
41     *(.bootstrap.init)
42     *(.bootstrap.text .bootstrap.text.* .bootstrap.gnu.linkonce.t.*)
43     *(.bootstrap.fini)
44
45     *(.bootstrap.rodata .bootstrap.rodata.* .bootstrap.gnu.linkonce.r.*)
46     *(.bootstrap.data .bootstrap.data.* .bootstrap.gnu.linkonce.d.*)
47     *(.bootstrap.anno)
48
49   } : btext
50   
51   . = ALIGN(0x10);
52   .bss_boot : {
53       *(.bootstrap.bss .bootstrap.gnu.linkonce.b.*)
54   . = ALIGN(0x1000);
55   PROVIDE(_boot_sys_end = .);
56   } : bdata
57
58   . = _kernel_image + _load;
59
60   .kip : AT(ADDR(.kip) - _fiasco_image_offset) {
61     _kernel_image_start = .;
62     *(.kernel_info_page)
63     _initkip_start = .;
64     KEEP(*(.initkip.version))
65     KEEP(*(.initkip.features))
66     KEEP(*(.initkip.features.fini))
67     _initkip_end = .;
68     . = ALIGN(4K);
69   } : kip = 0
70
71   .koptions : AT (ADDR(.koptions) - _fiasco_image_offset) {
72     *(.koptions)
73   } : koptions = 0
74
75 #ifdef CONFIG_ALLOW_RO_TEXT
76   . = ALIGN(4K);
77 #endif
78   .text : AT (ADDR(.text) - _fiasco_image_offset) {
79     PROVIDE ( _kernel_text_start = . );
80     crt0.o(.text)
81     *(.init)
82     *(.text SORT(.text.*) .gnu.linkonce.t.*)
83     *(.fini)
84
85     PROVIDE (_ecode = .);
86
87     *(.rodata .rodata.* .gnu.linkonce.r.*)
88
89     . = ALIGN(8);
90     PROVIDE (_log_table = .);
91     /*
92      * The section must start with ".debug" because else the linker
93      * complains about references to discarded sections
94      */
95     KEEP(*(SORT(.debug.jdb.log_table)))
96     PROVIDE (_log_table_end = .);
97
98     . = ALIGN(0x40);
99
100     PROVIDE (_etext = .);
101   } : ktext = 0x90909090
102
103 #ifdef CONFIG_ALLOW_RO_TEXT
104   . = ALIGN(4K);
105 #else
106   . = ALIGN(0x10);
107 #endif
108   .data : AT (ADDR(.data) - _fiasco_image_offset) {
109     PROVIDE (_kernel_data_start = .);
110     *(.data .data.* .gnu.linkonce.d.*)
111     *(.anno)
112
113     /* Constructor and destructor lists, ordered by priority.  The lists
114        are traversed from end to start, therefore the *_END__ symbols
115        precede the *_LIST__ symbols. */
116
117     __PER_CPU_CTORS_END__ = .;
118     KEEP (*(.ctors.00010))
119     KEEP (*(.ctors.00009))
120     KEEP (*(.ctors.00008))
121     KEEP (*(.ctors.00007))
122     KEEP (*(.ctors.00006))
123     KEEP (*(.ctors.00005))
124     KEEP (*(.ctors.00004))
125     KEEP (*(.ctors.00003))
126     KEEP (*(.ctors.00002))
127     KEEP (*(.ctors.00001))
128     __PER_CPU_CTORS_LIST__ = .;
129
130     __PER_CPU_LATE_CTORS_END__ = .;
131     KEEP (*(.ctors.00020))
132     KEEP (*(.ctors.00019))
133     KEEP (*(.ctors.00018))
134     KEEP (*(.ctors.00017))
135     KEEP (*(.ctors.00016))
136     KEEP (*(.ctors.00015))
137     KEEP (*(.ctors.00014))
138     KEEP (*(.ctors.00013))
139     KEEP (*(.ctors.00012))
140     KEEP (*(.ctors.00011))
141     __PER_CPU_LATE_CTORS_LIST__ = .;
142
143     __CTOR_END__ = .;
144     CONSTRUCTORS
145     KEEP (*(.ctors))
146     KEEP (*(SORT (.ctors.*)))
147     __CTOR_LIST__ = .;
148
149     __DTOR_END__ = .;    
150     KEEP (*(SORT (.dtors.*)))
151     KEEP (*(.dtors))
152     __DTOR_LIST__ = .;
153
154     PROVIDE (_edata = .);
155   } : kdata
156
157   . = ALIGN(32);
158   .per_cpu_data : AT (ADDR(.per_cpu_data) - _fiasco_image_offset) {
159     PROVIDE (_per_cpu_data_start = .);
160     *(.per_cpu.data)
161     . = ALIGN(8);
162     PROVIDE (_per_cpu_data_end = .);
163   } : kdata
164
165   . = ALIGN(0x10);
166   .bss : AT (ADDR(.bss) - _fiasco_image_offset) {
167     PROVIDE (_bss_start = .);
168     *(.bss .bss.* .gnu.linkonce.b.* COMMON)
169     PROVIDE (_bss_end = .);
170   } : kdata
171
172   PROVIDE (_end = .);
173
174   . = ALIGN(4096);
175   PROVIDE (_initcall_start = .);
176   .initcall.text : AT (ADDR(.initcall.text) - _fiasco_image_offset) {
177     *(.initcall.text*)
178     *(.text.*)
179   } : kitext = 0x90909090
180
181   .initcall.data : AT (ADDR(.initcall.data) - _fiasco_image_offset) {
182     *(.initcall.data*)
183     . = ALIGN(4096);
184     PROVIDE (_initcall_end = .);
185   } : kidata
186
187   /DISCARD/ : {
188     *(.note)
189     *(.note.ABI-tag)
190     *(.comment)
191     *(.eh_frame)
192   }
193 }