1/* ----------------------------------------------------------------------- 2 * 3 * Copyright 2009 Intel Corporation; author: H. Peter Anvin 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 8 * Boston MA 02110-1301, USA; either version 2 of the License, or 9 * (at your option) any later version; incorporated herein by reference. 10 * 11 * ----------------------------------------------------------------------- */ 12 13/* 14 * Linker script for MEMDISK 15 */ 16 17/* Script for -z combreloc: combine and sort reloc sections */ 18OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") 19OUTPUT_ARCH(i386) 20EXTERN(_start) 21ENTRY(_start) 22SECTIONS 23{ 24 /* Read-only sections, merged into text segment: */ 25 . = 0x100000; 26 PROVIDE (__executable_start = .); 27 28 .init : 29 { 30 KEEP (*(.init)) 31 } =0x90909090 32 .text : 33 { 34 *(.text .stub .text.* .gnu.linkonce.t.*) 35 /* .gnu.warning sections are handled specially by elf32.em. */ 36 *(.gnu.warning) 37 } =0x90909090 38 .fini : 39 { 40 KEEP (*(.fini)) 41 } =0x90909090 42 PROVIDE (__etext = .); 43 PROVIDE (_etext = .); 44 PROVIDE (etext = .); 45 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 46 .rodata1 : { *(.rodata1) } 47 48 /* Ensure the __preinit_array_start label is properly aligned. We 49 could instead move the label definition inside the section, but 50 the linker would then create the section even if it turns out to 51 be empty, which isn't pretty. */ 52 . = ALIGN(4); 53 PROVIDE (__preinit_array_start = .); 54 .preinit_array : { *(.preinit_array) } 55 PROVIDE (__preinit_array_end = .); 56 PROVIDE (__init_array_start = .); 57 .init_array : { *(.init_array) } 58 PROVIDE (__init_array_end = .); 59 PROVIDE (__fini_array_start = .); 60 .fini_array : { *(.fini_array) } 61 PROVIDE (__fini_array_end = .); 62 PROVIDE (__ctors_start = .); 63 .ctors : 64 { 65 KEEP (*(SORT(.ctors.*))) 66 KEEP (*(.ctors)) 67 } 68 PROVIDE (__ctors_end = .); 69 PROVIDE (__dtors_start = .); 70 .dtors : 71 { 72 KEEP (*(SORT(.dtors.*))) 73 KEEP (*(.dtors)) 74 } 75 PROVIDE (__dtors_end = .); 76 77 /* Adjust the address for the data segment. Avoid mixing code and 78 data within same 128-byte chunk. */ 79 . = ALIGN(128); 80 81 .data : 82 { 83 *(.data .data.* .gnu.linkonce.d.*) 84 SORT(CONSTRUCTORS) 85 } 86 .data1 : { *(.data1) } 87 _edata = .; 88 PROVIDE (edata = .); 89 . = ALIGN(16); 90 .bss : 91 { 92 __bss_start = .; 93 *(.dynbss) 94 *(.bss .bss.* .gnu.linkonce.b.*) 95 *(COMMON) 96 /* Align here to ensure that the .bss section occupies space up to 97 _end. Align after .bss to ensure correct alignment even if the 98 .bss section disappears because there are no input sections. */ 99 . = ALIGN(4); 100 __bss_end = .; 101 } 102 _end = .; 103 PROVIDE (end = .); 104 105 106 /* Stabs debugging sections. */ 107 .stab 0 : { *(.stab) } 108 .stabstr 0 : { *(.stabstr) } 109 .stab.excl 0 : { *(.stab.excl) } 110 .stab.exclstr 0 : { *(.stab.exclstr) } 111 .stab.index 0 : { *(.stab.index) } 112 .stab.indexstr 0 : { *(.stab.indexstr) } 113 .comment 0 : { *(.comment) } 114 /* DWARF debug sections. 115 Symbols in the DWARF debugging sections are relative to the beginning 116 of the section so we begin them at 0. */ 117 /* DWARF 1 */ 118 .debug 0 : { *(.debug) } 119 .line 0 : { *(.line) } 120 /* GNU DWARF 1 extensions */ 121 .debug_srcinfo 0 : { *(.debug_srcinfo) } 122 .debug_sfnames 0 : { *(.debug_sfnames) } 123 /* DWARF 1.1 and DWARF 2 */ 124 .debug_aranges 0 : { *(.debug_aranges) } 125 .debug_pubnames 0 : { *(.debug_pubnames) } 126 /* DWARF 2 */ 127 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 128 .debug_abbrev 0 : { *(.debug_abbrev) } 129 .debug_line 0 : { *(.debug_line) } 130 .debug_frame 0 : { *(.debug_frame) } 131 .debug_str 0 : { *(.debug_str) } 132 .debug_loc 0 : { *(.debug_loc) } 133 .debug_macinfo 0 : { *(.debug_macinfo) } 134 /* SGI/MIPS DWARF 2 extensions */ 135 .debug_weaknames 0 : { *(.debug_weaknames) } 136 .debug_funcnames 0 : { *(.debug_funcnames) } 137 .debug_typenames 0 : { *(.debug_typenames) } 138 .debug_varnames 0 : { *(.debug_varnames) } 139 /DISCARD/ : { *(.note.GNU-stack) } 140} 141