1 2CTOR=".ctors ${CONSTRUCTING-0} : 3 { 4 ${CONSTRUCTING+ __CTOR_LIST__ = .; } 5 /* gcc uses crtbegin.o to find the start of 6 the constructors, so we make sure it is 7 first. Because this is a wildcard, it 8 doesn't matter if the user does not 9 actually link against crtbegin.o; the 10 linker won't look for a file to match a 11 wildcard. The wildcard also means that it 12 doesn't matter which directory crtbegin.o 13 is in. */ 14 15 KEEP (*crtbegin*.o(.ctors)) 16 17 /* We don't want to include the .ctor section from 18 the crtend.o file until after the sorted ctors. 19 The .ctor section from the crtend file contains the 20 end of ctors marker and it must be last */ 21 22 KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors)) 23 KEEP (*(SORT(.ctors.*))) 24 KEEP (*(.ctors)) 25 ${CONSTRUCTING+ __CTOR_END__ = .; } 26 } ${RELOCATING+ > ${DATA_MEMORY}}" 27 28DTOR=" .dtors ${CONSTRUCTING-0} : 29 { 30 ${CONSTRUCTING+ __DTOR_LIST__ = .; } 31 KEEP (*crtbegin*.o(.dtors)) 32 KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors)) 33 KEEP (*(SORT(.dtors.*))) 34 KEEP (*(.dtors)) 35 ${CONSTRUCTING+ __DTOR_END__ = .; } 36 } ${RELOCATING+ > ${DATA_MEMORY}}" 37 38cat <<EOF 39OUTPUT_FORMAT("${OUTPUT_FORMAT}") 40OUTPUT_ARCH(${ARCH}) 41 42MEMORY 43{ 44 text ${TEXT_DEF_SECTION} : ORIGIN = ${TEXT_START_ADDR}, LENGTH = ${TEXT_SIZE} 45 data ${DATA_DEF_SECTION} : ORIGIN = ${DATA_START_ADDR}, LENGTH = ${DATA_SIZE} 46 emem ${EMEM_DEF_SECTION} : ORIGIN = ${EMEM_START_ADDR}, LENGTH = ${EMEM_SIZE} 47 eit : ORIGIN = ${EIT_START_ADDR}, LENGTH = ${EIT_SIZE} 48} 49 50SECTIONS 51{ 52 /* Read-only sections, merged into text segment: */ 53 ${TEXT_DYNAMIC+${DYNAMIC}} 54 .hash ${RELOCATING-0} : { *(.hash) } 55 .dynsym ${RELOCATING-0} : { *(.dynsym) } 56 .dynstr ${RELOCATING-0} : { *(.dynstr) } 57 .gnu.version ${RELOCATING-0} : { *(.gnu.version) } 58 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } 59 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } 60 61 .rel.text ${RELOCATING-0} : { *(.rel.text) *(.rel.gnu.linkonce.t*) } 62 .rela.text ${RELOCATING-0} : { *(.rela.text) *(.rela.gnu.linkonce.t*) } 63 .rel.data ${RELOCATING-0} : { *(.rel.data) *(.rel.gnu.linkonce.d*) } 64 .rela.data ${RELOCATING-0} : { *(.rela.data) *(.rela.gnu.linkonce.d*) } 65 .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } 66 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } 67 .rel.stext ${RELOCATING-0} : { *(.rel.stest) } 68 .rela.stext ${RELOCATING-0} : { *(.rela.stest) } 69 .rel.etext ${RELOCATING-0} : { *(.rel.etest) } 70 .rela.etext ${RELOCATING-0} : { *(.rela.etest) } 71 .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } 72 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } 73 .rel.edata ${RELOCATING-0} : { *(.rel.edata) } 74 .rela.edata ${RELOCATING-0} : { *(.rela.edata) } 75 .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } 76 .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) } 77 .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) } 78 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } 79 .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) } 80 .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } 81 .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) } 82 .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } 83 .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) } 84 .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } 85 .rel.got ${RELOCATING-0} : { *(.rel.got) } 86 .rela.got ${RELOCATING-0} : { *(.rela.got) } 87 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } 88 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } 89 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } 90 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } 91 .rel.init ${RELOCATING-0} : { *(.rel.init) } 92 .rela.init ${RELOCATING-0} : { *(.rela.init) } 93 .rel.fini ${RELOCATING-0} : { *(.rel.fini) } 94 .rela.fini ${RELOCATING-0} : { *(.rela.fini) } 95 .rel.bss ${RELOCATING-0} : { *(.rel.bss) } 96 .rela.bss ${RELOCATING-0} : { *(.rela.bss) } 97 .rel.plt ${RELOCATING-0} : { *(.rel.plt) } 98 .rela.plt ${RELOCATING-0} : { *(.rela.plt) } 99 100 .init ${RELOCATING-0} : { *(.init) } =${NOP-0} 101 ${DATA_PLT-${PLT}} 102 103 /* Internal text space */ 104 .stext ${RELOCATING-0} : { *(.stext) } ${RELOCATING+ > text} 105 106 /* Internal text space or external memory */ 107 .text : 108 { 109 *(.text) 110 *(.gnu.linkonce.t*) 111 *(.init) 112 *(.fini) 113 ${RELOCATING+ _etext = . ; } 114 } ${RELOCATING+ > ${TEXT_MEMORY}} 115 116 /* Internal data space */ 117 .srodata ${RELOCATING-0} : { *(.srodata) } ${RELOCATING+ > data} 118 .sdata ${RELOCATING-0} : { *(.sdata) } ${RELOCATING+ > data} 119 120 /* Internal data space or external memory */ 121 .rodata ${RELOCATING-0} : { *(.rodata) } ${RELOCATING+ > ${DATA_MEMORY}} 122 123 /* C++ exception support. */ 124 .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } ${RELOCATING+ > ${DATA_MEMORY}} 125 .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } ${RELOCATING+ > ${DATA_MEMORY}} 126 127 /* Java class registration support. */ 128 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } ${RELOCATING+ >${DATA_MEMORY}} 129 130 ${RELOCATING+${CTOR}} 131 ${RELOCATING+${DTOR}} 132 133 .data ${RELOCATING-0} : 134 { 135 *(.data) 136 *(.gnu.linkonce.d*) 137 ${CONSTRUCTING+CONSTRUCTORS} 138 ${RELOCATING+ _edata = . ; } 139 } ${RELOCATING+ > ${DATA_MEMORY}} 140 141 /* External memory */ 142 .etext ${RELOCATING-0} : 143 { 144 ${RELOCATING+ PROVIDE (__etext_start = .) ; } 145 *(.etext) 146 ${RELOCATING+ PROVIDE (__etext_end = .) ; } 147 } ${RELOCATING+ > emem} 148 149 .erodata ${RELOCATING-0} : { *(.erodata) } ${RELOCATING+ > emem} 150 .edata ${RELOCATING-0} : { *(.edata) } ${RELOCATING+ > emem} 151 152 .sbss ${RELOCATING-0} : 153 { 154 ${RELOCATING+ PROVIDE (__sbss_start = .) ; } 155 *(.sbss) 156 ${RELOCATING+ PROVIDE (__sbss_end = .) ; } 157 } ${RELOCATING+ > data} 158 159 .ebss ${RELOCATING-0} : 160 { 161 ${RELOCATING+ PROVIDE (__ebss_start = .) ; } 162 *(.ebss) 163 ${RELOCATING+ PROVIDE (__ebss_end = .) ; } 164 } ${RELOCATING+ > data} 165 166 .bss ${RELOCATING-0} : 167 { 168 ${RELOCATING+ PROVIDE (__bss_start = .) ; } 169 *(.bss) 170 *(COMMON) 171 ${RELOCATING+ PROVIDE (__bss_end = .) ; } 172 ${RELOCATING+ _end = . ; } 173 } ${RELOCATING+ > ${DATA_MEMORY}} 174 175 .eit_v ${RELOCATING-0} : 176 { 177 ${RELOCATING+ PROVIDE (__eit_start = .) ; } 178 *(.eit_v) 179 ${RELOCATING+ PROVIDE (__eit_end = .) ; } 180 } ${RELOCATING+ > eit} 181 182 /* Stabs debugging sections. */ 183 .stab 0 : { *(.stab) } 184 .stabstr 0 : { *(.stabstr) } 185 .stab.excl 0 : { *(.stab.excl) } 186 .stab.exclstr 0 : { *(.stab.exclstr) } 187 .stab.index 0 : { *(.stab.index) } 188 .stab.indexstr 0 : { *(.stab.indexstr) } 189 190 .comment 0 : { *(.comment) } 191 192 /* DWARF debug sections. 193 Symbols in the DWARF debugging sections are relative to the beginning 194 of the section so we begin them at 0. */ 195 196 /* DWARF 1 */ 197 .debug 0 : { *(.debug) } 198 .line 0 : { *(.line) } 199 200 /* GNU DWARF 1 extensions */ 201 .debug_srcinfo 0 : { *(.debug_srcinfo) } 202 .debug_sfnames 0 : { *(.debug_sfnames) } 203 204 /* DWARF 1.1 and DWARF 2 */ 205 .debug_aranges 0 : { *(.debug_aranges) } 206 .debug_pubnames 0 : { *(.debug_pubnames) } 207 208 /* DWARF 2 */ 209 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 210 .debug_abbrev 0 : { *(.debug_abbrev) } 211 .debug_line 0 : { *(.debug_line) } 212 .debug_frame 0 : { *(.debug_frame) } 213 .debug_str 0 : { *(.debug_str) } 214 .debug_loc 0 : { *(.debug_loc) } 215 .debug_macinfo 0 : { *(.debug_macinfo) } 216 217 PROVIDE (__stack = ${STACK_START_ADDR}); 218} 219EOF 220 221 222 223 224