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