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")
25 /* Prefix structure for the compression program */
31 /* "Early" sections (before the load) */
34 .earlybss (NOLOAD) : {
39 __earlybss_len = ABSOLUTE(__earlybss_end) - ABSOLUTE(__earlybss_start);
40 __earlybss_dwords = (__earlybss_len + 3) >> 2;
48 __bss16_len = ABSOLUTE(__bss16_end) - ABSOLUTE(__bss16_start);
49 __bss16_dwords = (__bss16_len + 3) >> 2;
52 .config : AT (__config_lma) {
57 __config_len = ABSOLUTE(__config_end) - ABSOLUTE(__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 = .;
66 __replacestub_end = .;
68 __replacestub_len = ABSOLUTE(__replacestub_end) - ABSOLUTE(__replacestub_start);
69 __replacestub_dwords = (__replacestub_len + 3) >> 2;
73 .gentextnr : AT(__gentextnr_lma) {
74 __gentextnr_start = .;
78 __gentextnr_len = ABSOLUTE(__gentextnr_end) - ABSOLUTE(__gentextnr_start);
79 __gentextnr_dwords = (__gentextnr_len + 3) >> 2;
82 .stack16 : AT(STACK_BASE) {
87 __stack16_len = ABSOLUTE(__stack16_end) - ABSOLUTE(__stack16_start);
88 __stack16_dwords = (__stack16_len + 3) >> 2;
90 /* Initialized sections */
99 __init_len = ABSOLUTE(__init_end) - ABSOLUTE(__init_start);
100 __init_dwords = (__init_len + 3) >> 2;
108 __text16_len = ABSOLUTE(__text16_end) - ABSOLUTE(__text16_start);
109 __text16_dwords = (__text16_len + 3) >> 2;
112 * .textnr is used for 32-bit code that is used on the code
113 * path to initialize the .text segment
122 __textnr_len = ABSOLUTE(__textnr_end) - ABSOLUTE(__textnr_start);
123 __textnr_dwords = (__textnr_len + 3) >> 2;
130 __bcopyxx_text_start = .;
132 __bcopyxx_text_end = .;
134 __bcopyxx_text_len = ABSOLUTE(__bcopyxx_text_end) - ABSOLUTE(__bcopyxx_text_start);
135 __bcopyxx_text_dwords = (__bcopyxx_text_len + 3) >> 2;
138 __bcopyxx_data_start = .;
140 __bcopyxx_data_end = .;
142 __bcopyxx_data_len = ABSOLUTE(__bcopyxx_data_end) - ABSOLUTE(__bcopyxx_data_start);
143 __bcopyxx_data_dwords = (__bcopyxx_data_len + 3) >> 2;
146 __bcopyxx_len = ABSOLUTE(__bcopyxx_end) - ABSOLUTE(__bcopyxx_start);
147 __bcopyxx_dwords = (__bcopyxx_len + 3) >> 2;
155 __data16_len = ABSOLUTE(__data16_end) - ABSOLUTE(__data16_start);
156 __data16_dwords = (__data16_len + 3) >> 2;
160 . += SIZEOF(.config);
163 __replacestub_lma = .;
164 . += SIZEOF(.replacestub);
166 /* The 32-bit code loads above the non-progbits sections */
171 __high_clear_start = .;
179 __adv_len = ABSOLUTE(__adv_end) - ABSOLUTE(__adv_start);
180 __adv_dwords = (__adv_len + 3) >> 2;
182 /* Late uninitialized sections */
190 __uibss_len = ABSOLUTE(__uibss_end) - ABSOLUTE(__uibss_start);
191 __uibss_dwords = (__uibss_len + 3) >> 2;
194 __assert_end16 = ASSERT(_end16 <= 0x10000, "64K overflow");
197 * Special 16-bit segments
201 .real_mode (NOLOAD) : {
204 real_mode_seg = core_real_mode >> 4;
207 .xfer_buf (NOLOAD) : {
210 xfer_buf_seg = core_xfer_buf >> 4;
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.
223 __auxseg_len = ABSOLUTE(__auxseg_end) - ABSOLUTE(__auxseg_start);
224 __auxseg_dwords = (__auxseg_len + 3) >> 2;
225 aux_seg = __auxseg_start >> 4;
228 * Used to allocate lowmem buffers from 32-bit code
235 __lowmem_len = ABSOLUTE(__lowmem_end) - ABSOLUTE(__lowmem_start);
236 __lowmem_dwords = (__lowmem_len + 3) >> 2;
238 __high_clear_end = .;
240 __high_clear_len = ABSOLUTE(__high_clear_end) - ABSOLUTE(__high_clear_start);
241 __high_clear_dwords = (__high_clear_len + 3) >> 2;
243 /* Start of the lowmem heap */
248 * 32-bit code. This is a hack for the moment due to the
249 * real-mode segments also allocated.
257 __text_lma = __pm_code_lma;
258 .text : AT(__text_lma) {
269 __rodata_lma = __rodata_vma + __text_lma - __text_vma;
270 .rodata : AT(__rodata_lma) {
280 __ctors_lma = __ctors_vma + __text_lma - __text_vma;
281 .ctors : AT(__ctors_lma) {
283 KEEP (*(SORT(.preinit_array*)))
284 KEEP (*(SORT(.init_array*)))
285 KEEP (*(SORT(.ctors*)))
290 __dtors_lma = __dtors_vma + __text_lma - __text_vma;
291 .dtors : AT(__dtors_lma) {
293 KEEP (*(SORT(.fini_array*)))
294 KEEP (*(SORT(.dtors*)))
301 __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
302 .dynlink : AT(__dynlink_lma) {
311 __got_lma = __got_vma + __text_lma - __text_vma;
312 .got : AT(__got_lma) {
320 __data_lma = __data_vma + __text_lma - __text_vma;
321 .data : AT(__data_lma) {
329 __pm_code_len = ABSOLUTE(__pm_code_end) - ABSOLUTE(__pm_code_start);
330 __pm_code_dwords = (__pm_code_len + 3) >> 2;
335 __bss_lma = .; /* Dummy */
336 .bss (NOLOAD) : AT (__bss_lma) {
343 __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
344 __bss_dwords = (__bss_len + 3) >> 2;
346 /* Very large objects which don't need to be zeroed */
349 __hugebss_lma = .; /* Dummy */
350 .hugebss (NOLOAD) : AT (__hugebss_lma) {
356 __hugebss_len = ABSOLUTE(__hugebss_end) - ABSOLUTE(__hugebss_start);
357 __hugebss_dwords = (__hugebss_len + 3) >> 2;
360 /* XXX: This stack should be unified with the COM32 stack */
362 __stack_lma = .; /* Dummy */
363 .stack (NOLOAD) : AT(__stack_lma) {
368 __stack_len = ABSOLUTE(__stack_end) - ABSOLUTE(__stack_start);
369 __stack_dwords = (__stack_len + 3) >> 2;
373 /* COM32R and kernels are loaded after our own PM code */
375 free_high_memory = .;
377 /* Stuff we don't need... */