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) */
36 .earlybss (NOLOAD) : {
41 __earlybss_len = ABSOLUTE(__earlybss_end) - ABSOLUTE(__earlybss_start);
42 __earlybss_dwords = (__earlybss_len + 3) >> 2;
50 __bss16_len = ABSOLUTE(__bss16_end) - ABSOLUTE(__bss16_start);
51 __bss16_dwords = (__bss16_len + 3) >> 2;
54 .config : AT (__config_lma) {
59 __config_len = ABSOLUTE(__config_end) - ABSOLUTE(__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 = ABSOLUTE(__replacestub_end) - ABSOLUTE(__replacestub_start);
71 __replacestub_dwords = (__replacestub_len + 3) >> 2;
75 .gentextnr : AT(__gentextnr_lma) {
76 __gentextnr_start = .;
80 __gentextnr_len = ABSOLUTE(__gentextnr_end) - ABSOLUTE(__gentextnr_start);
81 __gentextnr_dwords = (__gentextnr_len + 3) >> 2;
84 .stack16 : AT(STACK_BASE) {
89 __stack16_len = ABSOLUTE(__stack16_end) - ABSOLUTE(__stack16_start);
90 __stack16_dwords = (__stack16_len + 3) >> 2;
92 /* Initialized sections */
101 __init_len = ABSOLUTE(__init_end) - ABSOLUTE(__init_start);
102 __init_dwords = (__init_len + 3) >> 2;
110 __text16_len = ABSOLUTE(__text16_end) - ABSOLUTE(__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 = ABSOLUTE(__textnr_end) - ABSOLUTE(__textnr_start);
125 __textnr_dwords = (__textnr_len + 3) >> 2;
132 __bcopyxx_text_start = .;
134 __bcopyxx_text_end = .;
136 __bcopyxx_text_len = ABSOLUTE(__bcopyxx_text_end) - ABSOLUTE(__bcopyxx_text_start);
137 __bcopyxx_text_dwords = (__bcopyxx_text_len + 3) >> 2;
140 __bcopyxx_data_start = .;
142 __bcopyxx_data_end = .;
144 __bcopyxx_data_len = ABSOLUTE(__bcopyxx_data_end) - ABSOLUTE(__bcopyxx_data_start);
145 __bcopyxx_data_dwords = (__bcopyxx_data_len + 3) >> 2;
148 __bcopyxx_len = ABSOLUTE(__bcopyxx_end) - ABSOLUTE(__bcopyxx_start);
149 __bcopyxx_dwords = (__bcopyxx_len + 3) >> 2;
157 __data16_len = ABSOLUTE(__data16_end) - ABSOLUTE(__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 = ABSOLUTE(__adv_end) - ABSOLUTE(__adv_start);
182 __adv_dwords = (__adv_len + 3) >> 2;
184 /* Late uninitialized sections */
192 __uibss_len = ABSOLUTE(__uibss_end) - ABSOLUTE(__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 * Used to allocate lowmem buffers from 32-bit code
222 __lowmem_len = ABSOLUTE(__lowmem_end) - ABSOLUTE(__lowmem_start);
223 __lowmem_dwords = (__lowmem_len + 3) >> 2;
225 __high_clear_end = .;
227 __high_clear_len = ABSOLUTE(__high_clear_end) - ABSOLUTE(__high_clear_start);
228 __high_clear_dwords = (__high_clear_len + 3) >> 2;
230 /* Start of the lowmem heap */
235 * 32-bit code. This is a hack for the moment due to the
236 * real-mode segments also allocated.
244 __text_lma = __pm_code_lma;
245 .text : AT(__text_lma) {
256 __rodata_lma = __rodata_vma + __text_lma - __text_vma;
257 .rodata : AT(__rodata_lma) {
267 __ctors_lma = __ctors_vma + __text_lma - __text_vma;
268 .ctors : AT(__ctors_lma) {
270 KEEP (*(SORT(.preinit_array*)))
271 KEEP (*(SORT(.init_array*)))
272 KEEP (*(SORT(.ctors*)))
277 __dtors_lma = __dtors_vma + __text_lma - __text_vma;
278 .dtors : AT(__dtors_lma) {
280 KEEP (*(SORT(.fini_array*)))
281 KEEP (*(SORT(.dtors*)))
288 __dynsym_lma = __dynsym_vma + __text_lma - __text_vma;
289 .dynsym : AT(__dynsym_lma) {
294 __dynsym_len = __dynsym_end - __dynsym_start;
299 __dynstr_lma = __dynstr_vma + __text_lma - __text_vma;
300 .dynstr : AT(__dynstr_lma) {
305 __dynstr_len = __dynstr_end - __dynstr_start;
310 __gnu_hash_lma = __gnu_hash_vma + __text_lma - __text_vma;
311 .gnu.hash : AT(__gnu_hash_lma) {
312 __gnu_hash_start = .;
321 __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
322 .dynlink : AT(__dynlink_lma) {
331 __got_lma = __got_vma + __text_lma - __text_vma;
332 .got : AT(__got_lma) {
342 __dynamic_lma = __dynamic_vma + __text_lma - __text_vma;
343 .dynamic : AT(__dynamic_lma) {
352 __data_lma = __data_vma + __text_lma - __text_vma;
353 .data : AT(__data_lma) {
361 __pm_code_len = ABSOLUTE(__pm_code_end) - ABSOLUTE(__pm_code_start);
362 __pm_code_dwords = (__pm_code_len + 3) >> 2;
367 __bss_lma = .; /* Dummy */
368 .bss (NOLOAD) : AT (__bss_lma) {
375 __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
376 __bss_dwords = (__bss_len + 3) >> 2;
378 /* Very large objects which don't need to be zeroed */
383 __hugebss_lma = .; /* Dummy */
384 .hugebss (NOLOAD) : AT (__hugebss_lma) {
390 __hugebss_len = ABSOLUTE(__hugebss_end) - ABSOLUTE(__hugebss_start);
391 __hugebss_dwords = (__hugebss_len + 3) >> 2;
393 /* Data saved away before bss initialization */
397 __savedata_lma = .; /* Dummy */
398 .savedata (NOLOAD) : AT (__savedata_lma) {
399 __savedata_start = .;
404 __savedata_len = ABSOLUTE(__savedata_end) - ABSOLUTE(__savedata_start);
405 __savedata_dwords = (__savedata_len + 3) >> 2;
407 /* XXX: This stack should be unified with the COM32 stack */
409 __stack_lma = .; /* Dummy */
410 .stack (NOLOAD) : AT(__stack_lma) {
415 __stack_len = ABSOLUTE(__stack_end) - ABSOLUTE(__stack_start);
416 __stack_dwords = (__stack_len + 3) >> 2;
420 /* COM32R and kernels are loaded after our own PM code */
422 free_high_memory = .;
424 /* Stuff we don't need... */