freebsd.ld (6332B)
1 /* use ld --verbose to find default script! */ 2 3 /* Script for -z combreloc: combine and sort reloc sections */ 4 OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", 5 "elf32-i386-freebsd") 6 OUTPUT_ARCH(i386) 7 ENTRY(_start) 8 SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); 9 /* Do we need any of these for elf? 10 __DYNAMIC = 0; */ 11 SECTIONS 12 { 13 /* Read-only sections, merged into text segment: */ 14 PROVIDE (__executable_start = 0x80000000); . = 0x80000000 + SIZEOF_HEADERS; 15 .interp : { *(.interp) } 16 .hash : { *(.hash) } 17 .dynsym : { *(.dynsym) } 18 .dynstr : { *(.dynstr) } 19 .gnu.version : { *(.gnu.version) } 20 .gnu.version_d : { *(.gnu.version_d) } 21 .gnu.version_r : { *(.gnu.version_r) } 22 .rel.dyn : 23 { 24 *(.rel.init) 25 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) 26 *(.rel.fini) 27 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) 28 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) 29 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) 30 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) 31 *(.rel.ctors) 32 *(.rel.dtors) 33 *(.rel.got) 34 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) 35 } 36 .rela.dyn : 37 { 38 *(.rela.init) 39 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) 40 *(.rela.fini) 41 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) 42 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) 43 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) 44 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) 45 *(.rela.ctors) 46 *(.rela.dtors) 47 *(.rela.got) 48 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) 49 } 50 .rel.plt : { *(.rel.plt) } 51 .rela.plt : { *(.rela.plt) } 52 .init : 53 { 54 KEEP (*(.init)) 55 } =0x90909090 56 .plt : { *(.plt) } 57 .text : 58 { 59 *(.text .stub .text.* .gnu.linkonce.t.*) 60 /* .gnu.warning sections are handled specially by elf32.em. */ 61 *(.gnu.warning) 62 } =0x90909090 63 .fini : 64 { 65 KEEP (*(.fini)) 66 } =0x90909090 67 PROVIDE (__etext = .); 68 PROVIDE (_etext = .); 69 PROVIDE (etext = .); 70 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 71 .rodata1 : { *(.rodata1) } 72 .eh_frame_hdr : { *(.eh_frame_hdr) } 73 /* Adjust the address for the data segment. We want to adjust up to 74 the same address within the page on the next page up. */ 75 . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); 76 /* Ensure the __preinit_array_start label is properly aligned. We 77 could instead move the label definition inside the section, but 78 the linker would then create the section even if it turns out to 79 be empty, which isn't pretty. */ 80 . = ALIGN(32 / 8); 81 PROVIDE (__preinit_array_start = .); 82 .preinit_array : { *(.preinit_array) } 83 PROVIDE (__preinit_array_end = .); 84 PROVIDE (__init_array_start = .); 85 .init_array : { *(.init_array) } 86 PROVIDE (__init_array_end = .); 87 PROVIDE (__fini_array_start = .); 88 .fini_array : { *(.fini_array) } 89 PROVIDE (__fini_array_end = .); 90 .data : 91 { 92 *(.data .data.* .gnu.linkonce.d.*) 93 SORT(CONSTRUCTORS) 94 } 95 .data1 : { *(.data1) } 96 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 97 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 98 .eh_frame : { KEEP (*(.eh_frame)) } 99 .gcc_except_table : { *(.gcc_except_table) } 100 .dynamic : { *(.dynamic) } 101 .ctors : 102 { 103 /* gcc uses crtbegin.o to find the start of 104 the constructors, so we make sure it is 105 first. Because this is a wildcard, it 106 doesn't matter if the user does not 107 actually link against crtbegin.o; the 108 linker won't look for a file to match a 109 wildcard. The wildcard also means that it 110 doesn't matter which directory crtbegin.o 111 is in. */ 112 KEEP (*crtbegin*.o(.ctors)) 113 /* We don't want to include the .ctor section from 114 from the crtend.o file until after the sorted ctors. 115 The .ctor section from the crtend file contains the 116 end of ctors marker and it must be last */ 117 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) 118 KEEP (*(SORT(.ctors.*))) 119 KEEP (*(.ctors)) 120 } 121 .dtors : 122 { 123 KEEP (*crtbegin*.o(.dtors)) 124 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) 125 KEEP (*(SORT(.dtors.*))) 126 KEEP (*(.dtors)) 127 } 128 .jcr : { KEEP (*(.jcr)) } 129 .got : { *(.got.plt) *(.got) } 130 _edata = .; 131 PROVIDE (edata = .); 132 __bss_start = .; 133 .bss : 134 { 135 *(.dynbss) 136 *(.bss .bss.* .gnu.linkonce.b.*) 137 *(COMMON) 138 /* Align here to ensure that the .bss section occupies space up to 139 _end. Align after .bss to ensure correct alignment even if the 140 .bss section disappears because there are no input sections. */ 141 . = ALIGN(32 / 8); 142 } 143 . = ALIGN(32 / 8); 144 _end = .; 145 PROVIDE (end = .); 146 . = DATA_SEGMENT_END (.); 147 /* Stabs debugging sections. */ 148 .stab 0 : { *(.stab) } 149 .stabstr 0 : { *(.stabstr) } 150 .stab.excl 0 : { *(.stab.excl) } 151 .stab.exclstr 0 : { *(.stab.exclstr) } 152 .stab.index 0 : { *(.stab.index) } 153 .stab.indexstr 0 : { *(.stab.indexstr) } 154 .comment 0 : { *(.comment) } 155 /* DWARF debug sections. 156 Symbols in the DWARF debugging sections are relative to the beginning 157 of the section so we begin them at 0. */ 158 /* DWARF 1 */ 159 .debug 0 : { *(.debug) } 160 .line 0 : { *(.line) } 161 /* GNU DWARF 1 extensions */ 162 .debug_srcinfo 0 : { *(.debug_srcinfo) } 163 .debug_sfnames 0 : { *(.debug_sfnames) } 164 /* DWARF 1.1 and DWARF 2 */ 165 .debug_aranges 0 : { *(.debug_aranges) } 166 .debug_pubnames 0 : { *(.debug_pubnames) } 167 /* DWARF 2 */ 168 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 169 .debug_abbrev 0 : { *(.debug_abbrev) } 170 .debug_line 0 : { *(.debug_line) } 171 .debug_frame 0 : { *(.debug_frame) } 172 .debug_str 0 : { *(.debug_str) } 173 .debug_loc 0 : { *(.debug_loc) } 174 .debug_macinfo 0 : { *(.debug_macinfo) } 175 /* SGI/MIPS DWARF 2 extensions */ 176 .debug_weaknames 0 : { *(.debug_weaknames) } 177 .debug_funcnames 0 : { *(.debug_funcnames) } 178 .debug_typenames 0 : { *(.debug_typenames) } 179 .debug_varnames 0 : { *(.debug_varnames) } 180 /DISCARD/ : { *(.note.GNU-stack) } 181 } 182 183