1 /* -----------------------------------------------------------------------
3 * Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
4 * Copyright 2009 Intel Corporation; author: H. Peter Anvin
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.
12 * ----------------------------------------------------------------------- */
15 * Linker script for the SYSLINUX core
18 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
27 /* Prefix structure for the compression program */
33 /* "Early" sections (before the load) */
41 __earlybss_len = __earlybss_end - __earlybss_start;
42 __earlybss_dwords = (__earlybss_len + 3) >> 2;
50 __bss16_len = __bss16_end - __bss16_start;
51 __bss16_dwords = (__bss16_len + 3) >> 2;
54 .config : AT (__config_lma) {
59 __config_len = __config_end - __config_start;
60 __config_dwords = (__config_len + 3) >> 2;
62 /* Generated and/or copied code */
64 . = ALIGN(128); /* Minimum separation from mutable data */
65 .replacestub : AT (__replacestub_lma) {
66 __replacestub_start = .;
68 __replacestub_end = .;
70 __replacestub_len = __replacestub_end - __replacestub_start;
71 __replacestub_dwords = (__replacestub_len + 3) >> 2;
75 .gentextnr : AT(__gentextnr_lma) {
76 __gentextnr_start = .;
80 __gentextnr_len = __gentextnr_end - __gentextnr_start;
81 __gentextnr_dwords = (__gentextnr_len + 3) >> 2;
84 .stack16 : AT(STACK_BASE) {
89 __stack16_len = __stack16_end - __stack16_start;
90 __stack16_dwords = (__stack16_len + 3) >> 2;
92 /* Initialized sections */
101 __init_len = __init_end - __init_start;
102 __init_dwords = (__init_len + 3) >> 2;
110 __text16_len = __text16_end - __text16_start;
111 __text16_dwords = (__text16_len + 3) >> 2;
114 * .textnr is used for 32-bit code that is used on the code
115 * path to initialize the .text segment
124 __textnr_len = __textnr_end - __textnr_start;
125 __textnr_dwords = (__textnr_len + 3) >> 2;
132 __bcopyxx_text_start = .;
134 __bcopyxx_text_end = .;
136 __bcopyxx_text_len = __bcopyxx_text_end - __bcopyxx_text_start;
137 __bcopyxx_text_dwords = (__bcopyxx_text_len + 3) >> 2;
140 __bcopyxx_data_start = .;
142 __bcopyxx_data_end = .;
144 __bcopyxx_data_len = __bcopyxx_data_end - __bcopyxx_data_start;
145 __bcopyxx_data_dwords = (__bcopyxx_data_len + 3) >> 2;
148 __bcopyxx_len = __bcopyxx_end - __bcopyxx_start;
149 __bcopyxx_dwords = (__bcopyxx_len + 3) >> 2;
157 __data16_len = __data16_end - __data16_start;
158 __data16_dwords = (__data16_len + 3) >> 2;
162 . += SIZEOF(.config);
165 __replacestub_lma = .;
166 . += SIZEOF(.replacestub);
168 /* The 32-bit code loads above the non-progbits sections */
173 __high_clear_start = .;
181 __adv_len = __adv_end - __adv_start;
182 __adv_dwords = (__adv_len + 3) >> 2;
184 /* Late uninitialized sections */
192 __uibss_len = __uibss_end - __uibss_start;
193 __uibss_dwords = (__uibss_len + 3) >> 2;
196 __assert_end16 = ASSERT(_end16 <= 0x10000, "64K overflow");
199 * Special 16-bit segments
203 .real_mode (NOLOAD) : {
206 real_mode_seg = core_real_mode >> 4;
209 .xfer_buf (NOLOAD) : {
212 xfer_buf_seg = core_xfer_buf >> 4;
215 * The auxilliary data segment is used by the 16-bit code
216 * for items that don't need to live in the bottom 64K.
225 __auxseg_len = __auxseg_end - __auxseg_start;
226 __auxseg_dwords = (__auxseg_len + 3) >> 2;
227 aux_seg = __auxseg_start >> 4;
230 * Used to allocate lowmem buffers from 32-bit code
237 __lowmem_len = __lowmem_end - __lowmem_start;
238 __lowmem_dwords = (__lowmem_len + 3) >> 2;
240 __high_clear_end = .;
242 __high_clear_len = __high_clear_end - __high_clear_start;
243 __high_clear_dwords = (__high_clear_len + 3) >> 2;
245 /* Start of the lowmem heap */
250 * 32-bit code. This is a hack for the moment due to the
251 * real-mode segments also allocated.
259 __text_lma = __pm_code_lma;
260 .text : AT(__text_lma) {
271 __rodata_lma = __rodata_vma + __text_lma - __text_vma;
272 .rodata : AT(__rodata_lma) {
282 __ctors_lma = __ctors_vma + __text_lma - __text_vma;
283 .ctors : AT(__ctors_lma) {
285 KEEP (*(SORT(.ctors.*)))
291 __dtors_lma = __dtors_vma + __text_lma - __text_vma;
292 .dtors : AT(__dtors_lma) {
294 KEEP (*(SORT(.dtors.*)))
302 __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
303 .dynlink : AT(__dynlink_lma) {
312 __got_lma = __got_vma + __text_lma - __text_vma;
313 .got : AT(__got_lma) {
321 __data_lma = __data_vma + __text_lma - __text_vma;
322 .data : AT(__data_lma) {
330 __pm_code_len = __pm_code_end - __pm_code_start;
331 __pm_code_dwords = (__pm_code_len + 3) >> 2;
336 __bss_lma = .; /* Dummy */
337 .bss (NOLOAD) : AT (__bss_lma) {
344 __bss_len = __bss_end - __bss_start;
345 __bss_dwords = (__bss_len + 3) >> 2;
347 /* Very large objects which don't need to be zeroed */
350 __hugebss_lma = .; /* Dummy */
351 .hugebss (NOLOAD) : AT (__hugebss_lma) {
357 __hugebss_len = __hugebss_end - __hugebss_start;
358 __hugebss_dwords = (__hugebss_len + 3) >> 2;
361 /* XXX: This stack should be unified with the COM32 stack */
363 __stack_lma = .; /* Dummy */
364 .stack (NOLOAD) : AT(__stack_lma) {
369 __stack_len = __stack_end - __stack_start;
370 __stack_dwords = (__stack_len + 3) >> 2;
374 /* COM32R and kernels are loaded after our own PM code */
376 free_high_memory = .;
378 /* Stuff we don't need... */