1OUTPUT_FORMAT("elf32-i386", "elf32-i386", 2 "elf32-i386") 3OUTPUT_ARCH(i386) 4ENTRY(_start) 5 6PHDRS 7{ 8 text PT_LOAD ; 9 data PT_LOAD ; 10} 11 12SECTIONS 13{ 14 . = 0x0; 15 .interp : { *(.interp) } : text 16 .note.gnu.build-id : { *(.note.gnu.build-id) } 17 .hash : { *(.hash) } 18 .gnu.hash : { *(.gnu.hash) } 19 .dynsym : { *(.dynsym) } 20 .dynstr : { *(.dynstr) } 21 .gnu.version : { *(.gnu.version) } 22 .gnu.version_d : { *(.gnu.version_d) } 23 .gnu.version_r : { *(.gnu.version_r) } 24 .rel.init : { *(.rel.init) } 25 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 26 .rel.fini : { *(.rel.fini) } 27 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 28 .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } 29 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 30 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 31 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 32 .rel.ctors : { *(.rel.ctors) } 33 .rel.dtors : { *(.rel.dtors) } 34 .rel.got : { *(.rel.got) } 35 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 36 .rel.ifunc : { *(.rel.ifunc) } 37 .rel.plt : 38 { 39 *(.rel.plt) 40 PROVIDE_HIDDEN (__rel_iplt_start = .); 41 *(.rel.iplt) 42 PROVIDE_HIDDEN (__rel_iplt_end = .); 43 } 44 .init : 45 { 46 KEEP (*(.init)) 47 } =0x90909090 48 .plt : { *(.plt) *(.iplt) } 49 .text : 50 { 51 *(.text.unlikely .text.*_unlikely) 52 *(.text.exit .text.exit.*) 53 *(.text.startup .text.startup.*) 54 *(.text.hot .text.hot.*) 55 *(.text .stub .text.* .gnu.linkonce.t.*) 56 /* .gnu.warning sections are handled specially by elf32.em. */ 57 *(.gnu.warning) 58 } =0x90909090 59 .fini : 60 { 61 KEEP (*(.fini)) 62 } =0x90909090 63 PROVIDE (__etext = .); 64 PROVIDE (_etext = .); 65 PROVIDE (etext = .); 66 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 67 .rodata1 : { *(.rodata1) } 68 .eh_frame_hdr : { *(.eh_frame_hdr) } 69 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 70 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table 71 .gcc_except_table.*) } 72 /* These sections are generated by the Sun/Oracle C++ compiler. */ 73 .exception_ranges : ONLY_IF_RO { *(.exception_ranges 74 .exception_ranges*) } 75 /* Adjust the address for the data segment. We want to adjust up to 76 the same address within the page on the next page up. */ 77 . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); 78 /* Exception handling */ 79 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 80 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 81 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } 82 /* Thread Local Storage sections */ 83 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 84 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 85 .preinit_array : 86 { 87 PROVIDE_HIDDEN (__preinit_array_start = .); 88 KEEP (*(.preinit_array)) 89 PROVIDE_HIDDEN (__preinit_array_end = .); 90 } 91 .init_array : 92 { 93 PROVIDE_HIDDEN (__init_array_start = .); 94 KEEP (*(SORT(.init_array.*))) 95 KEEP (*(.init_array)) 96 PROVIDE_HIDDEN (__init_array_end = .); 97 } 98 .fini_array : 99 { 100 PROVIDE_HIDDEN (__fini_array_start = .); 101 KEEP (*(SORT(.fini_array.*))) 102 KEEP (*(.fini_array)) 103 PROVIDE_HIDDEN (__fini_array_end = .); 104 } 105 .ctors : 106 { 107 /* gcc uses crtbegin.o to find the start of 108 the constructors, so we make sure it is 109 first. Because this is a wildcard, it 110 doesn't matter if the user does not 111 actually link against crtbegin.o; the 112 linker won't look for a file to match a 113 wildcard. The wildcard also means that it 114 doesn't matter which directory crtbegin.o 115 is in. */ 116 KEEP (*crtbegin.o(.ctors)) 117 KEEP (*crtbegin?.o(.ctors)) 118 /* We don't want to include the .ctor section from 119 the crtend.o file until after the sorted ctors. 120 The .ctor section from the crtend file contains the 121 end of ctors marker and it must be last */ 122 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 123 KEEP (*(SORT(.ctors.*))) 124 KEEP (*(.ctors)) 125 } 126 .dtors : 127 { 128 KEEP (*crtbegin.o(.dtors)) 129 KEEP (*crtbegin?.o(.dtors)) 130 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 131 KEEP (*(SORT(.dtors.*))) 132 KEEP (*(.dtors)) 133 } 134 .jcr : { KEEP (*(.jcr)) } 135 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } :data 136 .dynamic : { *(.dynamic) } 137 .got : { *(.got) *(.igot) } 138 . = DATA_SEGMENT_RELRO_END (12, .); 139 .got.plt : { *(.got.plt) *(.igot.plt) } 140 .data : 141 { 142 *(.data .data.* .gnu.linkonce.d.*) 143 SORT(CONSTRUCTORS) 144 } 145 .data1 : { *(.data1) } 146 _edata = .; PROVIDE (edata = .); 147 __bss_start = .; 148 .bss : 149 { 150 *(.dynbss) 151 *(.bss .bss.* .gnu.linkonce.b.*) 152 *(COMMON) 153 /* Align here to ensure that the .bss section occupies space up to 154 _end. Align after .bss to ensure correct alignment even if the 155 .bss section disappears because there are no input sections. 156 FIXME: Why do we need it? When there is no .bss section, we don't 157 pad the .data section. */ 158 . = ALIGN(. != 0 ? 32 / 8 : 1); 159 } 160 . = ALIGN(32 / 8); 161 . = ALIGN(32 / 8); 162 _end = .; PROVIDE (end = .); 163 . = DATA_SEGMENT_END (.); 164 /* Stabs debugging sections. */ 165 .stab 0 : { *(.stab) } 166 .stabstr 0 : { *(.stabstr) } 167 .stab.excl 0 : { *(.stab.excl) } 168 .stab.exclstr 0 : { *(.stab.exclstr) } 169 .stab.index 0 : { *(.stab.index) } 170 .stab.indexstr 0 : { *(.stab.indexstr) } 171 .comment 0 : { *(.comment) } 172 /* DWARF debug sections. 173 Symbols in the DWARF debugging sections are relative to the beginning 174 of the section so we begin them at 0. */ 175 /* DWARF 1 */ 176 .debug 0 : { *(.debug) } 177 .line 0 : { *(.line) } 178 /* GNU DWARF 1 extensions */ 179 .debug_srcinfo 0 : { *(.debug_srcinfo) } 180 .debug_sfnames 0 : { *(.debug_sfnames) } 181 /* DWARF 1.1 and DWARF 2 */ 182 .debug_aranges 0 : { *(.debug_aranges) } 183 .debug_pubnames 0 : { *(.debug_pubnames) } 184 /* DWARF 2 */ 185 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 186 .debug_abbrev 0 : { *(.debug_abbrev) } 187 .debug_line 0 : { *(.debug_line) } 188 .debug_frame 0 : { *(.debug_frame) } 189 .debug_str 0 : { *(.debug_str) } 190 .debug_loc 0 : { *(.debug_loc) } 191 .debug_macinfo 0 : { *(.debug_macinfo) } 192 /* SGI/MIPS DWARF 2 extensions */ 193 .debug_weaknames 0 : { *(.debug_weaknames) } 194 .debug_funcnames 0 : { *(.debug_funcnames) } 195 .debug_typenames 0 : { *(.debug_typenames) } 196 .debug_varnames 0 : { *(.debug_varnames) } 197 /* DWARF 3 */ 198 .debug_pubtypes 0 : { *(.debug_pubtypes) } 199 .debug_ranges 0 : { *(.debug_ranges) } 200 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 201 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 202} 203