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} : { *(.eh_frame) } ${RELOCATING+ > ${DATA_MEMORY}} 125 126 ${RELOCATING+${CTOR}} 127 ${RELOCATING+${DTOR}} 128 129 .data ${RELOCATING-0} : 130 { 131 *(.data) 132 *(.gnu.linkonce.d*) 133 ${CONSTRUCTING+CONSTRUCTORS} 134 ${RELOCATING+ _edata = . ; } 135 } ${RELOCATING+ > ${DATA_MEMORY}} 136 137 /* External memory */ 138 .etext ${RELOCATING-0} : 139 { 140 ${RELOCATING+ PROVIDE (__etext_start = .) ; } 141 *(.etext) 142 ${RELOCATING+ PROVIDE (__etext_end = .) ; } 143 } ${RELOCATING+ > emem} 144 145 .erodata ${RELOCATING-0} : { *(.erodata) } ${RELOCATING+ > emem} 146 .edata ${RELOCATING-0} : { *(.edata) } ${RELOCATING+ > emem} 147 148 .sbss ${RELOCATING-0} : 149 { 150 ${RELOCATING+ PROVIDE (__sbss_start = .) ; } 151 *(.sbss) 152 ${RELOCATING+ PROVIDE (__sbss_end = .) ; } 153 } ${RELOCATING+ > data} 154 155 .ebss ${RELOCATING-0} : 156 { 157 ${RELOCATING+ PROVIDE (__ebss_start = .) ; } 158 *(.ebss) 159 ${RELOCATING+ PROVIDE (__ebss_end = .) ; } 160 } ${RELOCATING+ > data} 161 162 .bss ${RELOCATING-0} : 163 { 164 ${RELOCATING+ PROVIDE (__bss_start = .) ; } 165 *(.bss) 166 *(COMMON) 167 ${RELOCATING+ PROVIDE (__bss_end = .) ; } 168 ${RELOCATING+ _end = . ; } 169 } ${RELOCATING+ > ${DATA_MEMORY}} 170 171 .eit_v ${RELOCATING-0} : 172 { 173 ${RELOCATING+ PROVIDE (__eit_start = .) ; } 174 *(.eit_v) 175 ${RELOCATING+ PROVIDE (__eit_end = .) ; } 176 } ${RELOCATING+ > eit} 177 178 /* Stabs debugging sections. */ 179 .stab 0 : { *(.stab) } 180 .stabstr 0 : { *(.stabstr) } 181 .stab.excl 0 : { *(.stab.excl) } 182 .stab.exclstr 0 : { *(.stab.exclstr) } 183 .stab.index 0 : { *(.stab.index) } 184 .stab.indexstr 0 : { *(.stab.indexstr) } 185 186 .comment 0 : { *(.comment) } 187 188 /* DWARF debug sections. 189 Symbols in the DWARF debugging sections are relative to the beginning 190 of the section so we begin them at 0. */ 191 192 /* DWARF 1 */ 193 .debug 0 : { *(.debug) } 194 .line 0 : { *(.line) } 195 196 /* GNU DWARF 1 extensions */ 197 .debug_srcinfo 0 : { *(.debug_srcinfo) } 198 .debug_sfnames 0 : { *(.debug_sfnames) } 199 200 /* DWARF 1.1 and DWARF 2 */ 201 .debug_aranges 0 : { *(.debug_aranges) } 202 .debug_pubnames 0 : { *(.debug_pubnames) } 203 204 /* DWARF 2 */ 205 .debug_info 0 : { *(.debug_info) } 206 .debug_abbrev 0 : { *(.debug_abbrev) } 207 .debug_line 0 : { *(.debug_line) } 208 .debug_frame 0 : { *(.debug_frame) } 209 .debug_str 0 : { *(.debug_str) } 210 .debug_loc 0 : { *(.debug_loc) } 211 .debug_macinfo 0 : { *(.debug_macinfo) } 212 213 PROVIDE (__stack = ${STACK_START_ADDR}); 214} 215EOF 216 217 218 219 220