1/* Default linker script, for normal executables */ 2/* From binutils-2.19 */ 3OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", 4 "elf32-powerpc") 5OUTPUT_ARCH(powerpc:common) 6ENTRY(_start) 7SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); 8 9PHDRS 10{ 11 phdr PT_PHDR PHDRS; 12 interp PT_INTERP; 13 ro PT_LOAD FILEHDR PHDRS; 14 rw PT_LOAD; 15 dyn PT_DYNAMIC; 16 ehf PT_GNU_EH_FRAME; 17 L4_DEFINE_L4PHDRS 18} 19 20SECTIONS 21{ 22 /* Read-only sections, merged into text segment: */ 23 PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x01800000)); . = SEGMENT_START("text-segment", 0x01800000) + SIZEOF_HEADERS; 24 .interp : { *(.interp) } 25 .note.gnu.build-id : { *(.note.gnu.build-id) } 26 .hash : { *(.hash) } 27 .gnu.hash : { *(.gnu.hash) } 28 .dynsym : { *(.dynsym) } 29 .dynstr : { *(.dynstr) } 30 .gnu.version : { *(.gnu.version) } 31 .gnu.version_d : { *(.gnu.version_d) } 32 .gnu.version_r : { *(.gnu.version_r) } 33 .rel.init : { *(.rel.init) } 34 .rela.init : { *(.rela.init) } 35 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 36 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 37 .rel.fini : { *(.rel.fini) } 38 .rela.fini : { *(.rela.fini) } 39 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 40 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 41 .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } 42 .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } 43 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 44 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 45 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 46 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 47 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 48 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 49 .rel.ctors : { *(.rel.ctors) } 50 .rela.ctors : { *(.rela.ctors) } 51 .rel.dtors : { *(.rel.dtors) } 52 .rela.dtors : { *(.rela.dtors) } 53 .rel.got : { *(.rel.got) } 54 .rela.got : { *(.rela.got) } 55 .rela.got1 : { *(.rela.got1) } 56 .rela.got2 : { *(.rela.got2) } 57 .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 58 .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 59 .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 60 .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } 61 .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 62 .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 63 .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 64 .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 65 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 66 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 67 .rel.plt : { *(.rel.plt) } 68 .rela.plt : { *(.rela.plt) } 69 .init : 70 { 71 KEEP (*(.init)) 72 } =0 73 .text : 74 { 75 *(.text .stub .text.* .gnu.linkonce.t.*) 76 KEEP (*(.text.*personality*)) 77 /* .gnu.warning sections are handled specially by elf32.em. */ 78 *(.gnu.warning) 79 *(.glink) 80 } =0 81 .fini : 82 { 83 KEEP (*(.fini)) 84 } =0 85 PROVIDE (__etext = .); 86 PROVIDE (_etext = .); 87 PROVIDE (etext = .); 88 .rol4re_elf_aux : { 89 KEEP (*(.rol4re_elf_aux)) 90 } : ro : l4re_aux 91 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } : ro 92 .rodata1 : { *(.rodata1) } 93 .sdata2 : 94 { 95 PROVIDE (_SDA2_BASE_ = 32768); 96 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) 97 } 98 .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 99 .eh_frame_hdr : { *(.eh_frame_hdr) } 100 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 101 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } 102 /* Adjust the address for the data segment. We want to adjust up to 103 the same address within the page on the next page up. */ 104 . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); 105 /* Exception handling */ 106 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 107 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 108 /* Thread Local Storage sections */ 109 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 110 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 111 .preinit_array : 112 { 113 PROVIDE_HIDDEN (__preinit_array_start = .); 114 KEEP (*(.preinit_array)) 115 PROVIDE_HIDDEN (__preinit_array_end = .); 116 } 117 .init_array : 118 { 119 PROVIDE_HIDDEN (__init_array_start = .); 120 KEEP (*(SORT(.init_array.*))) 121 KEEP (*(.init_array)) 122 PROVIDE_HIDDEN (__init_array_end = .); 123 } 124 .fini_array : 125 { 126 PROVIDE_HIDDEN (__fini_array_start = .); 127 KEEP (*(.fini_array)) 128 KEEP (*(SORT(.fini_array.*))) 129 PROVIDE_HIDDEN (__fini_array_end = .); 130 } 131 .ctors : 132 { 133 /* gcc uses crtbegin.o to find the start of 134 the constructors, so we make sure it is 135 first. Because this is a wildcard, it 136 doesn't matter if the user does not 137 actually link against crtbegin.o; the 138 linker won't look for a file to match a 139 wildcard. The wildcard also means that it 140 doesn't matter which directory crtbegin.o 141 is in. */ 142 KEEP (*crtbegin.o(.ctors)) 143 KEEP (*crtbegin?.o(.ctors)) 144 /* We don't want to include the .ctor section from 145 the crtend.o file until after the sorted ctors. 146 The .ctor section from the crtend file contains the 147 end of ctors marker and it must be last */ 148 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 149 KEEP (*(SORT(.ctors.*))) 150 KEEP (*(.ctors)) 151 } 152 .dtors : 153 { 154 KEEP (*crtbegin.o(.dtors)) 155 KEEP (*crtbegin?.o(.dtors)) 156 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 157 KEEP (*(SORT(.dtors.*))) 158 KEEP (*(.dtors)) 159 } 160 .jcr : { KEEP (*(.jcr)) } 161 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } 162 .got1 : { *(.got1) } 163 .got2 : { *(.got2) } 164 .dynamic : { *(.dynamic) } 165 .got : SPECIAL { *(.got) } 166 . = DATA_SEGMENT_RELRO_END (0, .); 167 .plt : SPECIAL { *(.plt) } 168 .data : 169 { 170 *(.data .data.* .gnu.linkonce.d.*) 171 KEEP (*(.gnu.linkonce.d.*personality*)) 172 SORT(CONSTRUCTORS) 173 } 174 .data1 : { *(.data1) } 175 .got : SPECIAL { *(.got) } 176 /* We want the small data sections together, so single-instruction offsets 177 can access them all, and initialized data all before uninitialized, so 178 we can shorten the on-disk segment size. */ 179 .sdata : 180 { 181 PROVIDE (_SDA_BASE_ = 32768); 182 *(.sdata .sdata.* .gnu.linkonce.s.*) 183 } 184 _edata = .; PROVIDE (edata = .); 185 __bss_start = .; 186 .sbss : 187 { 188 PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .); 189 *(.dynsbss) 190 *(.sbss .sbss.* .gnu.linkonce.sb.*) 191 *(.scommon) 192 PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); 193 } 194 .plt : SPECIAL { *(.plt) } 195 .bss : 196 { 197 *(.dynbss) 198 *(.bss .bss.* .gnu.linkonce.b.*) 199 *(COMMON) 200 /* Align here to ensure that the .bss section occupies space up to 201 _end. Align after .bss to ensure correct alignment even if the 202 .bss section disappears because there are no input sections. 203 FIXME: Why do we need it? When there is no .bss section, we don't 204 pad the .data section. */ 205 . = ALIGN(. != 0 ? 32 / 8 : 1); 206 } 207 . = ALIGN(32 / 8); 208 . = ALIGN(32 / 8); 209 _end = .; PROVIDE (end = .); 210 . = DATA_SEGMENT_END (.); 211 /* Stabs debugging sections. */ 212 .stab 0 : { *(.stab) } 213 .stabstr 0 : { *(.stabstr) } 214 .stab.excl 0 : { *(.stab.excl) } 215 .stab.exclstr 0 : { *(.stab.exclstr) } 216 .stab.index 0 : { *(.stab.index) } 217 .stab.indexstr 0 : { *(.stab.indexstr) } 218 .comment 0 : { *(.comment) } 219 /* DWARF debug sections. 220 Symbols in the DWARF debugging sections are relative to the beginning 221 of the section so we begin them at 0. */ 222 /* DWARF 1 */ 223 .debug 0 : { *(.debug) } 224 .line 0 : { *(.line) } 225 /* GNU DWARF 1 extensions */ 226 .debug_srcinfo 0 : { *(.debug_srcinfo) } 227 .debug_sfnames 0 : { *(.debug_sfnames) } 228 /* DWARF 1.1 and DWARF 2 */ 229 .debug_aranges 0 : { *(.debug_aranges) } 230 .debug_pubnames 0 : { *(.debug_pubnames) } 231 /* DWARF 2 */ 232 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 233 .debug_abbrev 0 : { *(.debug_abbrev) } 234 .debug_line 0 : { *(.debug_line) } 235 .debug_frame 0 : { *(.debug_frame) } 236 .debug_str 0 : { *(.debug_str) } 237 .debug_loc 0 : { *(.debug_loc) } 238 .debug_macinfo 0 : { *(.debug_macinfo) } 239 /* SGI/MIPS DWARF 2 extensions */ 240 .debug_weaknames 0 : { *(.debug_weaknames) } 241 .debug_funcnames 0 : { *(.debug_funcnames) } 242 .debug_typenames 0 : { *(.debug_typenames) } 243 .debug_varnames 0 : { *(.debug_varnames) } 244 /* DWARF 3 */ 245 .debug_pubtypes 0 : { *(.debug_pubtypes) } 246 .debug_ranges 0 : { *(.debug_ranges) } 247 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 248 /DISCARD/ : { *(.fixup) } 249 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } 250} 251