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