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