acpi: moving flags_to_string to base code
[syslinux.git] / core / syslinux.ld
blobc1c884c593189dd204b2806848ad42c5d3e775aa
1 /* -----------------------------------------------------------------------
2  *   
3  *   Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
4  *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
5  *
6  *   This program is free software; you can redistribute it and/or modify
7  *   it under the terms of the GNU General Public License as published by
8  *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
9  *   Boston MA 02110-1301, USA; either version 2 of the License, or
10  *   (at your option) any later version; incorporated herein by reference.
11  *
12  * ----------------------------------------------------------------------- */
15  * Linker script for the SYSLINUX core
16  */
18 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
19 OUTPUT_ARCH(i386)
20 EXTERN(_start)
21 ENTRY(_start)
23 SECTIONS
25         /* Prefix structure for the compression program */
26         . = 0;
27         .prefix : {
28                 *(.prefix)
29         }
31         /* "Early" sections (before the load) */
32         . = 0x1000;
34         .earlybss (NOLOAD) : {
35                 __earlybss_start = .;
36                 *(.earlybss)
37                 __earlybss_end = .;
38         }
39         __earlybss_len = __earlybss_end - __earlybss_start;
40         __earlybss_dwords = (__earlybss_len + 3) >> 2;
42         . = ALIGN(4);
43         .bss16 (NOLOAD) : {
44                 __bss16_start = .;
45                 *(.bss16)
46                 __bss16_end = .;
47         }
48         __bss16_len = __bss16_end - __bss16_start;
49         __bss16_dwords = (__bss16_len + 3) >> 2;
51         . = ALIGN(4);
52         .config : AT (__config_lma) {
53                 __config_start = .;
54                 *(.config)
55                 __config_end = .;
56         }
57         __config_len = __config_end - __config_start;
58         __config_dwords = (__config_len + 3) >> 2;
60         /* Generated and/or copied code */
62         . = ALIGN(128);         /* Minimum separation from mutable data */
63         .replacestub : AT (__replacestub_lma) {
64                 __replacestub_start = .;
65                 *(.replacestub)
66                 __replacestub_end = .;
67         }
68         __replacestub_len = __replacestub_end - __replacestub_start;
69         __replacestub_dwords = (__replacestub_len + 3) >> 2;
71         . = ALIGN(16);
72         __gentextnr_lma = .;
73         .gentextnr : AT(__gentextnr_lma) {
74                 __gentextnr_start = .;
75                 *(.gentextnr)
76                 __gentextnr_end = .;
77         }
78         __gentextnr_len = __gentextnr_end - __gentextnr_start;
79         __gentextnr_dwords = (__gentextnr_len + 3) >> 2;
81         . = STACK_BASE;
82         .stack16 : AT(STACK_BASE) {
83                 __stack16_start = .;
84                 . += STACK_LEN;
85                 __stack16_end = .;
86         }
87         __stack16_len = __stack16_end - __stack16_start;
88         __stack16_dwords = (__stack16_len + 3) >> 2;
90         /* Initialized sections */
92         . = 0x7c00;
93         .init : {
94                 FILL(0x90909090)
95                 __init_start = .;
96                 *(.init)
97                 __init_end = .;
98         }
99         __init_len = __init_end - __init_start;
100         __init_dwords = (__init_len + 3) >> 2;
102         .text16 : {
103                 FILL(0x90909090)
104                 __text16_start = .;
105                 *(.text16)
106                 __text16_end = .;
107         }
108         __text16_len = __text16_end - __text16_start;
109         __text16_dwords = (__text16_len + 3) >> 2;
111         /*
112          * .textnr is used for 32-bit code that is used on the code
113          * path to initialize the .text segment
114          */
115         . = ALIGN(16);
116         .textnr : {
117                 FILL(0x90909090)
118                 __textnr_start = .;
119                 *(.textnr)
120                 __textnr_end = .;
121         }
122         __textnr_len = __textnr_end - __textnr_start;
123         __textnr_dwords = (__textnr_len + 3) >> 2;
125         . = ALIGN(16);
126         __bcopyxx_start = .;
128         .bcopyxx.text : {
129                 FILL(0x90909090)
130                 __bcopyxx_text_start = .;
131                 *(.bcopyxx.text)
132                 __bcopyxx_text_end = .;
133         }
134         __bcopyxx_text_len = __bcopyxx_text_end - __bcopyxx_text_start;
135         __bcopyxx_text_dwords = (__bcopyxx_text_len + 3) >> 2;
137         .bcopyxx.data : {
138                 __bcopyxx_data_start = .;
139                 *(.bcopyxx.text)
140                 __bcopyxx_data_end = .;
141         }
142         __bcopyxx_data_len = __bcopyxx_data_end - __bcopyxx_data_start;
143         __bcopyxx_data_dwords = (__bcopyxx_data_len + 3) >> 2;
145         __bcopyxx_end = .;
146         __bcopyxx_len = __bcopyxx_end - __bcopyxx_start;
147         __bcopyxx_dwords = (__bcopyxx_len + 3) >> 2;
149         . = ALIGN(4);
150         .data16 : {
151               __data16_start = .;
152               *(.data16)
153               __data16_end = .;
154         }
155         __data16_len = __data16_end - __data16_start;
156         __data16_dwords = (__data16_len + 3) >> 2;
158         . = ALIGN(4);
159         __config_lma = .;
160         . += SIZEOF(.config);
162         . = ALIGN(4);
163         __replacestub_lma = .;
164         . += SIZEOF(.replacestub);
166         /* The 32-bit code loads above the non-progbits sections */
168         . = ALIGN(16);
169         __pm_code_lma = .;
171         __high_clear_start = .;
173         . = ALIGN(512);
174         .adv (NOLOAD) : {
175                 __adv_start = .;
176                 *(.adv)
177                 __adv_end = .;
178         }
179         __adv_len = __adv_end - __adv_start;
180         __adv_dwords = (__adv_len + 3) >> 2;
182         /* Late uninitialized sections */
184         . = ALIGN(4);
185         .uibss (NOLOAD) : {
186                 __uibss_start = .;
187                 *(.uibss)
188                 __uibss_end = .;
189         }
190         __uibss_len = __uibss_end - __uibss_start;
191         __uibss_dwords = (__uibss_len + 3) >> 2;
193         _end16 = .;
194         __assert_end16 = ASSERT(_end16 <= 0x10000, "64K overflow");
196         /*
197          * Special 16-bit segments
198          */
200         . = ALIGN(65536);
201         .real_mode (NOLOAD) : {
202                 *(.real_mode)
203         }
204         real_mode_seg = core_real_mode >> 4;
206         . = ALIGN(65536);
207         .xfer_buf (NOLOAD) : {
208                 *(.xfer_buf)
209         }
210         xfer_buf_seg = core_xfer_buf >> 4;
212         /*
213          * The auxilliary data segment is used by the 16-bit code
214          * for items that don't need to live in the bottom 64K.
215          */
217         . = ALIGN(16);
218         .auxseg (NOLOAD) : {
219                 __auxseg_start = .;
220                 *(.auxseg)
221                 __auxseg_end = .;
222         }
223         __auxseg_len = __auxseg_end - __auxseg_start;
224         __auxseg_dwords = (__auxseg_len + 3) >> 2;
225         aux_seg = __auxseg_start >> 4;
227         /*
228          * Used to allocate lowmem buffers from 32-bit code
229          */
230         .lowmem (NOLOAD) : {
231                 __lowmem_start = .;
232                 *(.lowmem)
233                 __lowmem_end = .;
234         }
235         __lowmem_len = __lowmem_end - __lowmem_start;
236         __lowmem_dwords = (__lowmem_len + 3) >> 2;
238         __high_clear_end = .;
240         __high_clear_len = __high_clear_end - __high_clear_start;
241         __high_clear_dwords = (__high_clear_len + 3) >> 2;
243         /* Start of the lowmem heap */
244         . = ALIGN(16);
245         __lowmem_heap = .;
247         /*
248          * 32-bit code.  This is a hack for the moment due to the
249          * real-mode segments also allocated.
250          */
252         . = 0x100000;
254         __pm_code_start = .;
256         __text_vma = .;
257         __text_lma = __pm_code_lma;
258         .text : AT(__text_lma) {
259                 FILL(0x90909090)
260                 __text_start = .;
261                 *(.text)
262                 *(.text.*)
263                 __text_end = .;
264         }
266         . = ALIGN(16);
268         __rodata_vma = .;
269         __rodata_lma = __rodata_vma + __text_lma - __text_vma;
270         .rodata : AT(__rodata_lma) {
271                 __rodata_start = .;
272                 *(.rodata)
273                 *(.rodata.*)
274                 __rodata_end = .;
275         }
277         . = ALIGN(4);
279         __ctors_vma = .;
280         __ctors_lma = __ctors_vma + __text_lma - __text_vma;
281         .ctors : AT(__ctors_lma) {
282                 __ctors_start = .;
283                 KEEP (*(SORT(.ctors.*)))
284                 KEEP (*(.ctors))
285                 __ctors_end = .;
286         }
288         __dtors_vma = .;
289         __dtors_lma = __dtors_vma + __text_lma - __text_vma;
290         .dtors : AT(__dtors_lma) {
291                 __dtors_start = .;
292                 KEEP (*(SORT(.dtors.*)))
293                 KEEP (*(.dtors))
294                 __dtors_end = .;
295         }
297         . = ALIGN(4);
299         __dynlink_vma = .;
300         __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
301         .dynlink : AT(__dynlink_lma) {
302                 __dynlink_start = .;
303                 *(.dynlink)
304                 __dynlink_end = .;
305         }
307         . = ALIGN(4);
309         __got_vma = .;
310         __got_lma = __got_vma + __text_lma - __text_vma;
311         .got : AT(__got_lma) {
312                 __got_start = .;
313                 KEEP (*(.got.plt))
314                 KEEP (*(.got))
315                 __got_end = .;
316         }
318         __data_vma = .;
319         __data_lma = __data_vma + __text_lma - __text_vma;
320         .data : AT(__data_lma) {
321                 __data_start = .;
322                 *(.data)
323                 *(.data.*)
324                 __data_end = .;
325         }
327         __pm_code_end = .;
328         __pm_code_len = __pm_code_end - __pm_code_start;
329         __pm_code_dwords = (__pm_code_len + 3) >> 2;
331         . = ALIGN(128);
332         
333         __bss_vma = .;
334         __bss_lma = .;          /* Dummy */
335         .bss (NOLOAD) : AT (__bss_lma) {
336                 __bss_start = .;
337                 *(.bss)
338                 *(.bss.*)
339                 *(COMMON)
340                 __bss_end = .;
341         }
342         __bss_len = __bss_end - __bss_start;
343         __bss_dwords = (__bss_len + 3) >> 2;
345         /* Very large objects which don't need to be zeroed */
347         __hugebss_vma = .;
348         __hugebss_lma = .;              /* Dummy */
349         .hugebss (NOLOAD) : AT (__hugebss_lma) {
350                 __hugebss_start = .;
351                 *(.hugebss)
352                 *(.hugebss.*)
353                 __hugebss_end = .;
354         }
355         __hugebss_len = __hugebss_end - __hugebss_start;
356         __hugebss_dwords = (__hugebss_len + 3) >> 2;
359         /* XXX: This stack should be unified with the COM32 stack */
360         __stack_vma = .;
361         __stack_lma = .;        /* Dummy */
362         .stack (NOLOAD) : AT(__stack_lma) {
363                 __stack_start = .;
364                 *(.stack)
365                 __stack_end = .;
366         }
367         __stack_len = __stack_end - __stack_start;
368         __stack_dwords = (__stack_len + 3) >> 2;
370         _end = .;
372         /* COM32R and kernels are loaded after our own PM code */
373         . = ALIGN(65536);
374         free_high_memory = .;
376         /* Stuff we don't need... */
377         /DISCARD/ : {
378                 *(.eh_frame)
379         }