Home | History | Annotate | Download | only in efi
      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  * ----------------------------------------------------------------------- */
     13 
     14 /*
     15  * Linker script for the SYSLINUX core
     16  */
     17 
     18 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
     19 OUTPUT_ARCH(i386)
     20 ENTRY(_start)
     21 
     22 SECTIONS
     23 {
     24 	. = 0;
     25 	ImageBase = .;		/* For gnu-efi's crt0 */
     26 	__module_start = .;
     27 	. = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
     28 	.text : {
     29 		FILL(0x90909090)
     30 		__text_start = .;
     31 		*(.text)
     32 		*(.text.*)
     33 		__text_end = .;
     34 	}
     35 
     36 	. = ALIGN(16);
     37 
     38 	.rodata : {
     39 		__rodata_start = .;
     40 		*(.rodata)
     41 		*(.rodata.*)
     42 		__rodata_end = .;
     43 	}
     44 
     45 	. = ALIGN(4);
     46 
     47 	.ctors : {
     48 		__ctors_start = .;
     49 		KEEP (*(SORT(.ctors.*)))
     50 		KEEP (*(.ctors))
     51 		__ctors_end = .;
     52 	}
     53 
     54 	.dtors : {
     55 		__dtors_start = .;
     56 		KEEP (*(SORT(.dtors.*)))
     57 		KEEP (*(.dtors))
     58 		__dtors_end = .;
     59 	}
     60 
     61 	. = ALIGN(4096);
     62 	.rel : {
     63 		*(.rel.got)
     64 		*(.rel.data)
     65 		*(.rel.data.*)
     66 		*(.rel.ctors)
     67 	}
     68 
     69 	. = ALIGN(4);
     70 
     71 	.gnu.hash : {
     72 		__gnu_hash_start = .;
     73 		*(.gnu.hash)
     74 		__gnu_hash_end = .;
     75 	}
     76 
     77 
     78 	.dynsym : {
     79 		__dynsym_start = .;
     80 		*(.dynsym)
     81 		__dynsym_end = .;
     82 	}
     83 
     84 	. = ALIGN(4);
     85 
     86 	.dynstr : {
     87 		__dynstr_start = .;
     88 		*(.dynstr)
     89 		__dynstr_end = .;
     90 	}
     91 
     92 	. = ALIGN(4);
     93 
     94 	.dynlink : {
     95 		__dynlink_start = .;
     96 		*(.dynlink)
     97 		__dynlink_end = .;
     98 	}
     99 
    100 	. = ALIGN(4);
    101 
    102 	.got : {
    103 		__got_start = .;
    104 		KEEP (*(.got.plt))
    105 		KEEP (*(.got))
    106 		__got_end = .;
    107 	}
    108 
    109 	. = ALIGN(4);
    110 
    111 	.dynamic : {
    112 		__dynamic_start = .;
    113 		*(.dynamic)
    114 		__dynamic_end = .;
    115 	}
    116 
    117 	. = ALIGN(16);
    118 
    119 	.data : {
    120 		__data_start = .;
    121 		*(.data)
    122 		*(.data.*)
    123 		*(.lowmem)
    124 		__data_end = .;
    125 	}
    126 
    127 	.reloc : {
    128 		*(.reloc)
    129 	}
    130 
    131 	.comment : {
    132 		*(.commet)
    133 	}
    134 
    135 	.symtab : {
    136 		*(.symtab)
    137 	}
    138 
    139 	.strtab : {
    140 		*(.strtab)
    141 	}
    142 
    143 	.bss : {
    144 		/* the EFI loader doesn't seem to like a .bss section,
    145 		   so we stick it all into .data: */
    146 		__bss_start = .;
    147 		*(.bss)
    148 		*(.bss.*)
    149 		*(.bss16)
    150 		*(.hugebss)
    151 		*(COMMON)
    152 		__bss_end = .;
    153 		*(.sbss)
    154 		*(.scommon)
    155 	}
    156 	__bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
    157 	__bss_dwords = (__bss_len + 3) >> 2;
    158 
    159 	. = ALIGN(128);
    160 
    161 	/* Very large objects which don't need to be zeroed */
    162 
    163 	.hugebss : {
    164 		__hugebss_start = .;
    165 		*(.hugebss)
    166 		*(.hugebss.*)
    167 		__hugebss_end = .;
    168 	}
    169 
    170 	_end = .;
    171 
    172 	/* Stuff we don't need... */
    173 	/DISCARD/ : {
    174 		*(.eh_frame)
    175 	}
    176 }
    177