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 from 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 .rela.text ${RELOCATING-0} : { *(.rela.text) *(.rela.gnu.linkonce.t*) } 62 .rela.data ${RELOCATING-0} : { *(.rela.data) *(.rela.gnu.linkonce.d*) } 63 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } 64 .rela.stext ${RELOCATING-0} : { *(.rela.stest) } 65 .rela.etext ${RELOCATING-0} : { *(.rela.etest) } 66 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } 67 .rela.edata ${RELOCATING-0} : { *(.rela.edata) } 68 .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) } 69 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } 70 .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } 71 .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } 72 .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } 73 .rela.got ${RELOCATING-0} : { *(.rela.got) } 74 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } 75 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } 76 .rela.init ${RELOCATING-0} : { *(.rela.init) } 77 .rela.fini ${RELOCATING-0} : { *(.rela.fini) } 78 .rela.bss ${RELOCATING-0} : { *(.rela.bss) } 79 .rela.plt ${RELOCATING-0} : { *(.rela.plt) } 80 81 .rel.data ${RELOCATING-0} : { *(.rel.data) *(.rel.gnu.linkonce.d*) } 82 .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } 83 .rel.stext ${RELOCATING-0} : { *(.rel.stest) } 84 .rel.etext ${RELOCATING-0} : { *(.rel.etest) } 85 .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } 86 .rel.edata ${RELOCATING-0} : { *(.rel.edata) } 87 .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) } 88 .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) } 89 .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } 90 .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) } 91 .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) } 92 .rel.got ${RELOCATING-0} : { *(.rel.got) } 93 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } 94 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } 95 .rel.init ${RELOCATING-0} : { *(.rel.init) } 96 .rel.fini ${RELOCATING-0} : { *(.rel.fini) } 97 .rel.bss ${RELOCATING-0} : { *(.rel.bss) } 98 .rel.plt ${RELOCATING-0} : { *(.rel.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 ${RELOCATING+${CTOR}} 128 ${RELOCATING+${DTOR}} 129 130 .data ${RELOCATING-0} : 131 { 132 *(.data) 133 *(.gnu.linkonce.d*) 134 ${CONSTRUCTING+CONSTRUCTORS} 135 ${RELOCATING+ _edata = . ; } 136 } ${RELOCATING+ > ${DATA_MEMORY}} 137 138 /* External memory */ 139 .etext ${RELOCATING-0} : 140 { 141 ${RELOCATING+ PROVIDE (__etext_start = .) ; } 142 *(.etext) 143 ${RELOCATING+ PROVIDE (__etext_end = .) ; } 144 } ${RELOCATING+ > emem} 145 146 .erodata ${RELOCATING-0} : { *(.erodata) } ${RELOCATING+ > emem} 147 .edata ${RELOCATING-0} : { *(.edata) } ${RELOCATING+ > emem} 148 149 .sbss ${RELOCATING-0} : 150 { 151 ${RELOCATING+ PROVIDE (__sbss_start = .) ; } 152 *(.sbss) 153 ${RELOCATING+ PROVIDE (__sbss_end = .) ; } 154 } ${RELOCATING+ > data} 155 156 .ebss ${RELOCATING-0} : 157 { 158 ${RELOCATING+ PROVIDE (__ebss_start = .) ; } 159 *(.ebss) 160 ${RELOCATING+ PROVIDE (__ebss_end = .) ; } 161 } ${RELOCATING+ > data} 162 163 .bss ${RELOCATING-0} : 164 { 165 ${RELOCATING+ PROVIDE (__bss_start = .) ; } 166 *(.bss) 167 *(COMMON) 168 ${RELOCATING+ PROVIDE (__bss_end = .) ; } 169 ${RELOCATING+ _end = . ; } 170 } ${RELOCATING+ > ${DATA_MEMORY}} 171 172 .eit_v ${RELOCATING-0} : 173 { 174 ${RELOCATING+ PROVIDE (__eit_start = .) ; } 175 *(.eit_v) 176 ${RELOCATING+ PROVIDE (__eit_end = .) ; } 177 } ${RELOCATING+ > eit} 178 179 /* Stabs debugging sections. */ 180 .stab 0 : { *(.stab) } 181 .stabstr 0 : { *(.stabstr) } 182 .stab.excl 0 : { *(.stab.excl) } 183 .stab.exclstr 0 : { *(.stab.exclstr) } 184 .stab.index 0 : { *(.stab.index) } 185 .stab.indexstr 0 : { *(.stab.indexstr) } 186 187 .comment 0 : { *(.comment) } 188 189 /* DWARF debug sections. 190 Symbols in the DWARF debugging sections are relative to the beginning 191 of the section so we begin them at 0. */ 192 193 /* DWARF 1 */ 194 .debug 0 : { *(.debug) } 195 .line 0 : { *(.line) } 196 197 /* GNU DWARF 1 extensions */ 198 .debug_srcinfo 0 : { *(.debug_srcinfo) } 199 .debug_sfnames 0 : { *(.debug_sfnames) } 200 201 /* DWARF 1.1 and DWARF 2 */ 202 .debug_aranges 0 : { *(.debug_aranges) } 203 .debug_pubnames 0 : { *(.debug_pubnames) } 204 205 /* DWARF 2 */ 206 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 207 .debug_abbrev 0 : { *(.debug_abbrev) } 208 .debug_line 0 : { *(.debug_line) } 209 .debug_frame 0 : { *(.debug_frame) } 210 .debug_str 0 : { *(.debug_str) } 211 .debug_loc 0 : { *(.debug_loc) } 212 .debug_macinfo 0 : { *(.debug_macinfo) } 213 214 PROVIDE (__stack = ${STACK_START_ADDR}); 215} 216EOF 217 218 219 220 221