Home | History | Annotate | Download | only in x86_64
      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("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
     19 OUTPUT_ARCH(i386:x86-64)
     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 	.symtab : {
    132 		*(.symtab)
    133 	}
    134 
    135 	.strtab : {
    136 		*(.strtab)
    137 	}
    138 
    139 	.bss (NOLOAD) : {
    140 		/* the EFI loader doesn't seem to like a .bss section,
    141 		   so we stick it all into .data: */
    142 		__bss_start = .;
    143 		*(.bss)
    144 		*(.bss.*)
    145 		*(.bss16)
    146 		*(.hugebss)
    147 		*(COMMON)
    148 		__bss_end = .;
    149 		*(.sbss)
    150 		*(.scommon)
    151 	}
    152 	__bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
    153 	__bss_dwords = (__bss_len + 3) >> 2;
    154 
    155 	. = ALIGN(128);
    156 
    157 	/* Very large objects which don't need to be zeroed */
    158 
    159 	.hugebss : {
    160 		__hugebss_start = .;
    161 		*(.hugebss)
    162 		*(.hugebss.*)
    163 		__hugebss_end = .;
    164 	}
    165 
    166 	_end = .;
    167 
    168 	/* Stuff we don't need... */
    169 	/DISCARD/ : {
    170 		*(.eh_frame)
    171 		*(.comment)
    172 	}
    173 }
    174