17d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)/* Default linker script, for normal executables */ 27d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") 37d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)OUTPUT_ARCH(i386:x86-64) 47d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)ENTRY(_start) 57d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)SECTIONS 67d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles){ 77d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) /* Read-only sections, merged into text segment: */ 87d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) . = 0x60000000 + SIZEOF_HEADERS; 97d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .interp : { *(.interp) } 107d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .hash : { *(.hash) } 117d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .dynsym : { *(.dynsym) } 127d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .dynstr : { *(.dynstr) } 137d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .gnu.version : { *(.gnu.version) } 147d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .gnu.version_d : { *(.gnu.version_d) } 157d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .gnu.version_r : { *(.gnu.version_r) } 167d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rel.init : { *(.rel.init) } 177d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rela.init : { *(.rela.init) } 18eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 19eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 207d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rel.fini : { *(.rel.fini) } 217d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rela.fini : { *(.rela.fini) } 227d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 237d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 247d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 257d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 26eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 27eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 28eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 29eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 30eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rel.ctors : { *(.rel.ctors) } 31eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rela.ctors : { *(.rela.ctors) } 327d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rel.dtors : { *(.rel.dtors) } 337d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rela.dtors : { *(.rela.dtors) } 347d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rel.got : { *(.rel.got) } 357d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rela.got : { *(.rela.got) } 367d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 377d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 387d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rel.plt : 397d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) { 407d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) *(.rel.plt) 417d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) PROVIDE_HIDDEN (__rel_iplt_start = .); 427d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) *(.rel.iplt) 437d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) PROVIDE_HIDDEN (__rel_iplt_end = .); 447d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) } 457d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rela.plt : 467d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) { 477d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) *(.rela.plt) 487d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) PROVIDE_HIDDEN (__rela_iplt_start = .); 497d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) *(.rela.iplt) 507d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) PROVIDE_HIDDEN (__rela_iplt_end = .); 517d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) } 527d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .init : 53eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch { 547d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) KEEP (*(.init)) 557d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) } =0x90909090 567d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .plt : { *(.plt) } 577d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .text : 58eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch { 59eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch *(.text .stub .text.* .gnu.linkonce.t.*) 60eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch /* .gnu.warning sections are handled specially by elf32.em. */ 61eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch *(.gnu.warning) 627d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) } =0x90909090 637d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .fini : 647d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) { 65eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch KEEP (*(.fini)) 66eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch } =0x90909090 67eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch PROVIDE (__etext = .); 68eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch PROVIDE (_etext = .); 69eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch PROVIDE (etext = .); 70eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 717d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .rodata1 : { *(.rodata1) } 727d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .eh_frame_hdr : { *(.eh_frame_hdr) } 737d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 747d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table) } 757d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) /* Adjust the address for the data segment. We want to adjust up to 767d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) the same address within the page on the next page up. */ 77 . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000); 78 /* Ensure the __preinit_array_start label is properly aligned. We 79 could instead move the label definition inside the section, but 80 the linker would then create the section even if it turns out to 81 be empty, which isn't pretty. */ 82 . = ALIGN(64 / 8); 83 PROVIDE (__preinit_array_start = .); 84 .preinit_array : { *(.preinit_array) } 85 PROVIDE (__preinit_array_end = .); 86 PROVIDE (__init_array_start = .); 87 .init_array : { *(.init_array) } 88 PROVIDE (__init_array_end = .); 89 PROVIDE (__fini_array_start = .); 90 .fini_array : { *(.fini_array) } 91 PROVIDE (__fini_array_end = .); 92 .data : 93 { 94 *(.data .data.* .gnu.linkonce.d.*) 95 SORT(CONSTRUCTORS) 96 } 97 .data1 : { *(.data1) } 98 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 99 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 100 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 101 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table) } 102 .dynamic : { *(.dynamic) } 103 .ctors : 104 { 105 /* gcc uses crtbegin.o to find the start of 106 the constructors, so we make sure it is 107 first. Because this is a wildcard, it 108 doesn't matter if the user does not 109 actually link against crtbegin.o; the 110 linker won't look for a file to match a 111 wildcard. The wildcard also means that it 112 doesn't matter which directory crtbegin.o 113 is in. */ 114 KEEP (*crtbegin.o(.ctors)) 115 /* We don't want to include the .ctor section from 116 from the crtend.o file until after the sorted ctors. 117 The .ctor section from the crtend file contains the 118 end of ctors marker and it must be last */ 119 KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 120 KEEP (*(SORT(.ctors.*))) 121 KEEP (*(.ctors)) 122 } 123 .dtors : 124 { 125 KEEP (*crtbegin.o(.dtors)) 126 KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 127 KEEP (*(SORT(.dtors.*))) 128 KEEP (*(.dtors)) 129 } 130 .jcr : { KEEP (*(.jcr)) } 131 .got : { *(.got.plt) *(.got) } 132 _edata = .; 133 PROVIDE (edata = .); 134 __bss_start = .; 135 .bss : 136 { 137 *(.dynbss) 138 *(.bss .bss.* .gnu.linkonce.b.*) 139 *(COMMON) 140 /* Align here to ensure that the .bss section occupies space up to 141 _end. Align after .bss to ensure correct alignment even if the 142 .bss section disappears because there are no input sections. */ 143 . = ALIGN(64 / 8); 144 } 145 . = ALIGN(64 / 8); 146 _end = .; 147 PROVIDE (end = .); 148 . = DATA_SEGMENT_END (.); 149 /* Stabs debugging sections. */ 150 .stab 0 : { *(.stab) } 151 .stabstr 0 : { *(.stabstr) } 152 .stab.excl 0 : { *(.stab.excl) } 153 .stab.exclstr 0 : { *(.stab.exclstr) } 154 .stab.index 0 : { *(.stab.index) } 155 .stab.indexstr 0 : { *(.stab.indexstr) } 156 .comment 0 : { *(.comment) } 157 /* DWARF debug sections. 158 Symbols in the DWARF debugging sections are relative to the beginning 159 of the section so we begin them at 0. */ 160 /* DWARF 1 */ 161 .debug 0 : { *(.debug) } 162 .line 0 : { *(.line) } 163 /* GNU DWARF 1 extensions */ 164 .debug_srcinfo 0 : { *(.debug_srcinfo) } 165 .debug_sfnames 0 : { *(.debug_sfnames) } 166 /* DWARF 1.1 and DWARF 2 */ 167 .debug_aranges 0 : { *(.debug_aranges) } 168 .debug_pubnames 0 : { *(.debug_pubnames) } 169 /* DWARF 2 */ 170 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 171 .debug_abbrev 0 : { *(.debug_abbrev) } 172 .debug_line 0 : { *(.debug_line) } 173 .debug_frame 0 : { *(.debug_frame) } 174 .debug_str 0 : { *(.debug_str) } 175 .debug_loc 0 : { *(.debug_loc) } 176 .debug_macinfo 0 : { *(.debug_macinfo) } 177 /* SGI/MIPS DWARF 2 extensions */ 178 .debug_weaknames 0 : { *(.debug_weaknames) } 179 .debug_funcnames 0 : { *(.debug_funcnames) } 180 .debug_typenames 0 : { *(.debug_typenames) } 181 .debug_varnames 0 : { *(.debug_varnames) } 182} 183