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