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