1test -z "$ENTRY" && ENTRY=_start 2test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} 3test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} 4if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi 5test "$LD_FLAG" = "N" && DATA_ADDR=. 6INTERP=".interp ${RELOCATING-0} : { *(.interp) }" 7PLT=".plt ${RELOCATING-0} : { *(.plt) }" 8 9 10CTOR=".ctors ${CONSTRUCTING-0} : 11 { 12 ${CONSTRUCTING+${CTOR_START}} 13 /* gcc uses crtbegin.o to find the start of 14 the constructors, so we make sure it is 15 first. Because this is a wildcard, it 16 doesn't matter if the user does not 17 actually link against crtbegin.o; the 18 linker won't look for a file to match a 19 wildcard. The wildcard also means that it 20 doesn't matter which directory crtbegin.o 21 is in. */ 22 23 KEEP (*crtbegin*.o(.ctors)) 24 25 /* We don't want to include the .ctor section from 26 from the crtend.o file until after the sorted ctors. 27 The .ctor section from the crtend file contains the 28 end of ctors marker and it must be last */ 29 30 KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors)) 31 KEEP (*(SORT(.ctors.*))) 32 KEEP (*(.ctors)) 33 ${CONSTRUCTING+${CTOR_END}} 34 }" 35 36DTOR=" .dtors ${CONSTRUCTING-0} : 37 { 38 ${CONSTRUCTING+${DTOR_START}} 39 KEEP (*crtbegin*.o(.dtors)) 40 KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors)) 41 KEEP (*(SORT(.dtors.*))) 42 KEEP (*(.dtors)) 43 ${CONSTRUCTING+${DTOR_END}} 44 }" 45 46STACK=" .stack : { _stack = .; *(.stack) } >STACK " 47 48# if this is for an embedded system, don't add SIZEOF_HEADERS. 49if [ -z "$EMBEDDED" ]; then 50 test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR} + SIZEOF_HEADERS" 51else 52 test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR}" 53fi 54 55cat <<EOF 56OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", 57 "${LITTLE_OUTPUT_FORMAT}") 58OUTPUT_ARCH(${OUTPUT_ARCH}) 59ENTRY(${ENTRY}) 60 61${RELOCATING+${LIB_SEARCH_DIRS}} 62${RELOCATING+/* Do we need any of these for elf? 63 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} 64${RELOCATING+${EXECUTABLE_SYMBOLS}} 65 66MEMORY 67{ 68 /* These are the values for the D10V-TS3 board. 69 There are other memory regions available on 70 the TS3 (eg ROM, FLASH, etc) but these are not 71 used by this script. */ 72 73 INSN : org = 0x01000000, len = 256K 74 DATA : org = 0x02000000, len = 48K 75 76 /* This is a fake memory region at the top of the 77 on-chip RAM, used as the start of the 78 (descending) stack. */ 79 80 STACK : org = 0x0200BFFC, len = 4 81} 82 83SECTIONS 84{ 85 .text ${RELOCATING+${TEXT_START_ADDR}} : 86 { 87 ${RELOCATING+${TEXT_START_SYMBOLS}} 88 KEEP (*(.init)) 89 KEEP (*(.init.*)) 90 KEEP (*(.fini)) 91 KEEP (*(.fini.*)) 92 *(.text) 93 *(.text.*) 94 /* .gnu.warning sections are handled specially by elf32.em. */ 95 *(.gnu.warning) 96 *(.gnu.linkonce.t*) 97 ${RELOCATING+_etext = .;} 98 ${RELOCATING+PROVIDE (etext = .);} 99 } ${RELOCATING+ >INSN} =${NOP-0} 100 101 .rodata ${RELOCATING+${READONLY_START_ADDR}} : { 102 *(.rodata) 103 *(.gnu.linkonce.r*) 104 *(.rodata.*) 105 } ${RELOCATING+ >DATA} 106 107 .rodata1 ${RELOCATING-0} : { 108 *(.rodata1) 109 *(.rodata1.*) 110 } ${RELOCATING+ >DATA} 111 112 .data ${RELOCATING-0} : 113 { 114 ${RELOCATING+${DATA_START_SYMBOLS}} 115 *(.data) 116 *(.data.*) 117 *(.gnu.linkonce.d*) 118 ${CONSTRUCTING+CONSTRUCTORS} 119 } ${RELOCATING+ >DATA} 120 121 .data1 ${RELOCATING-0} : { 122 *(.data1) 123 *(.data1.*) 124 } ${RELOCATING+ >DATA} 125 126 ${RELOCATING+${CTOR} >DATA} 127 ${RELOCATING+${DTOR} >DATA} 128 129 /* We want the small data sections together, so single-instruction offsets 130 can access them all, and initialized data all before uninitialized, so 131 we can shorten the on-disk segment size. */ 132 .sdata ${RELOCATING-0} : { 133 *(.sdata) 134 *(.sdata.*) 135 } ${RELOCATING+ >DATA} 136 137 ${RELOCATING+_edata = .;} 138 ${RELOCATING+PROVIDE (edata = .);} 139 ${RELOCATING+__bss_start = .;} 140 .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } ${RELOCATING+ >DATA} 141 .bss ${RELOCATING-0} : 142 { 143 *(.dynbss) 144 *(.dynbss.*) 145 *(.bss) 146 *(.bss.*) 147 *(COMMON) 148 } ${RELOCATING+ >DATA} 149 150 ${RELOCATING+_end = . ;} 151 ${RELOCATING+PROVIDE (end = .);} 152 153 ${RELOCATING+$STACK} 154 155 /* Stabs debugging sections. */ 156 .stab 0 : { *(.stab) } 157 .stabstr 0 : { *(.stabstr) } 158 .stab.excl 0 : { *(.stab.excl) } 159 .stab.exclstr 0 : { *(.stab.exclstr) } 160 .stab.index 0 : { *(.stab.index) } 161 .stab.indexstr 0 : { *(.stab.indexstr) } 162 163 .comment 0 : { *(.comment) } 164 165 /* DWARF debug sections. 166 Symbols in the DWARF debugging sections are relative to the beginning 167 of the section so we begin them at 0. */ 168 169 /* DWARF 1 */ 170 .debug 0 : { *(.debug) } 171 .line 0 : { *(.line) } 172 173 /* GNU DWARF 1 extensions */ 174 .debug_srcinfo 0 : { *(.debug_srcinfo) } 175 .debug_sfnames 0 : { *(.debug_sfnames) } 176 177 /* DWARF 1.1 and DWARF 2 */ 178 .debug_aranges 0 : { *(.debug_aranges) } 179 .debug_pubnames 0 : { *(.debug_pubnames) } 180 181 /* DWARF 2 */ 182 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 183 .debug_abbrev 0 : { *(.debug_abbrev) } 184 .debug_line 0 : { *(.debug_line) } 185 .debug_frame 0 : { *(.debug_frame) } 186 .debug_str 0 : { *(.debug_str) } 187 .debug_loc 0 : { *(.debug_loc) } 188 .debug_macinfo 0 : { *(.debug_macinfo) } 189 190 /* SGI/MIPS DWARF 2 extensions */ 191 .debug_weaknames 0 : { *(.debug_weaknames) } 192 .debug_funcnames 0 : { *(.debug_funcnames) } 193 .debug_typenames 0 : { *(.debug_typenames) } 194 .debug_varnames 0 : { *(.debug_varnames) } 195} 196EOF 197