Home | History | Annotate | Line # | Download | only in scripttempl
mmo.sc revision 1.1.1.1.2.1
      1  1.1.1.1.2.1  pgoyette # Copyright (C) 2014-2015 Free Software Foundation, Inc.
      2  1.1.1.1.2.1  pgoyette # 
      3  1.1.1.1.2.1  pgoyette # Copying and distribution of this file, with or without modification,
      4  1.1.1.1.2.1  pgoyette # are permitted in any medium without royalty provided the copyright
      5  1.1.1.1.2.1  pgoyette # notice and this notice are preserved.
      6  1.1.1.1.2.1  pgoyette 
      7          1.1  christos # MMO is not a relocateable format, and we don't want to require an
      8          1.1  christos # explicit (e.g.) "-m elf64mmix" when -r is used.
      9  1.1.1.1.2.1  pgoyette 
     10          1.1  christos test -z $RELOCATEABLE_OUTPUT_FORMAT && RELOCATEABLE_OUTPUT_FORMAT=$OUTPUT_FORMAT
     11          1.1  christos test -z ${RELOCATING+0} && OUTPUT_FORMAT=$RELOCATEABLE_OUTPUT_FORMAT
     12  1.1.1.1.2.1  pgoyette 
     13          1.1  christos cat <<EOF
     14  1.1.1.1.2.1  pgoyette /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
     15  1.1.1.1.2.1  pgoyette 
     16  1.1.1.1.2.1  pgoyette    Copying and distribution of this script, with or without modification,
     17  1.1.1.1.2.1  pgoyette    are permitted in any medium without royalty provided the copyright
     18  1.1.1.1.2.1  pgoyette    notice and this notice are preserved.  */
     19  1.1.1.1.2.1  pgoyette 
     20          1.1  christos OUTPUT_FORMAT("$OUTPUT_FORMAT")
     21          1.1  christos OUTPUT_ARCH(mmix)
     22          1.1  christos ${RELOCATING+ENTRY(Main)}
     23          1.1  christos SECTIONS
     24          1.1  christos {
     25          1.1  christos   .text ${RELOCATING+ ${TEXT_START_ADDR}}:
     26          1.1  christos   {
     27          1.1  christos     *(.text)
     28          1.1  christos     ${RELOCATING+*(.text.*)}
     29          1.1  christos     ${RELOCATING+*(.gnu.linkonce.t*)}
     30          1.1  christos     ${RELOCATING+*(.rodata)}
     31          1.1  christos     ${RELOCATING+*(.rodata.*)}
     32          1.1  christos     ${RELOCATING+*(.gnu.linkonce.r*)}
     33          1.1  christos 
     34          1.1  christos     /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections.  */
     35          1.1  christos     ${RELOCATING+ PROVIDE (_init_start = .);}
     36          1.1  christos     ${RELOCATING+ PROVIDE (_init = .);}
     37          1.1  christos     ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
     38          1.1  christos     ${RELOCATING+ PROVIDE (_init_end = .);}
     39          1.1  christos 
     40          1.1  christos     ${RELOCATING+ PROVIDE (_fini_start = .);}
     41          1.1  christos     ${RELOCATING+ PROVIDE (_fini = .);}
     42          1.1  christos     ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
     43          1.1  christos     ${RELOCATING+ PROVIDE (_fini_end = .);}
     44          1.1  christos 
     45          1.1  christos     /* FIXME: Align ctors, dtors, ehframe.  */
     46          1.1  christos     ${RELOCATING+ PROVIDE (_ctors_start = .);}
     47          1.1  christos     ${RELOCATING+ PROVIDE (__ctors_start = .);}
     48          1.1  christos     ${RELOCATING+ PROVIDE (_ctors = .);}
     49          1.1  christos     ${RELOCATING+ PROVIDE (__ctors = .);}
     50          1.1  christos     ${RELOCATING+ KEEP (*crtbegin.o(.ctors))}
     51          1.1  christos     ${RELOCATING+ KEEP (*crtbegin?.o(.ctors))}
     52          1.1  christos     ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
     53          1.1  christos     ${RELOCATING+ KEEP (*(SORT(.ctors.*)))}
     54          1.1  christos     ${RELOCATING+ KEEP (*(.ctors))}
     55          1.1  christos     ${RELOCATING+ PROVIDE (_ctors_end = .);}
     56          1.1  christos     ${RELOCATING+ PROVIDE (__ctors_end = .);}
     57          1.1  christos 
     58          1.1  christos     ${RELOCATING+ PROVIDE (_dtors_start = .);}
     59          1.1  christos     ${RELOCATING+ PROVIDE (__dtors_start = .);}
     60          1.1  christos     ${RELOCATING+ PROVIDE (_dtors = .);}
     61          1.1  christos     ${RELOCATING+ PROVIDE (__dtors = .);}
     62          1.1  christos     ${RELOCATING+ KEEP (*crtbegin.o(.dtors))}
     63          1.1  christos     ${RELOCATING+ KEEP (*crtbegin?.o(.dtors))}
     64          1.1  christos     ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
     65          1.1  christos     ${RELOCATING+ KEEP (*(SORT(.dtors.*)))}
     66          1.1  christos     ${RELOCATING+ KEEP (*(.dtors))}
     67          1.1  christos     ${RELOCATING+ PROVIDE (_dtors_end = .);}
     68          1.1  christos     ${RELOCATING+ PROVIDE (__dtors_end = .);}
     69          1.1  christos 
     70          1.1  christos     ${RELOCATING+KEEP (*(.jcr))}
     71          1.1  christos     ${RELOCATING+KEEP (*(.eh_frame))}
     72          1.1  christos     ${RELOCATING+*(.gcc_except_table)}
     73          1.1  christos 
     74          1.1  christos     ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : ADDR (.text));}
     75          1.1  christos   }
     76          1.1  christos 
     77          1.1  christos   /* The following NOP assignment and those after .data and .bss, are
     78          1.1  christos      necessary to get orphan sections adopted by the .text inserted before
     79          1.1  christos      the following end-section symbols.  An output section would also serve
     80          1.1  christos      this purpose, but we can't do that.  */
     81          1.1  christos   . = .;
     82          1.1  christos   ${RELOCATING+ PROVIDE(etext = .);}
     83          1.1  christos   ${RELOCATING+ PROVIDE(_etext = .);}
     84          1.1  christos   ${RELOCATING+ PROVIDE(__etext = .);}
     85          1.1  christos 
     86          1.1  christos   .data ${RELOCATING+ ${DATA_ADDR}}:
     87          1.1  christos   {
     88          1.1  christos     ${RELOCATING+ PROVIDE(__Sdata = .);}
     89          1.1  christos 
     90          1.1  christos     *(.data);
     91          1.1  christos     ${RELOCATING+*(.data.*)}
     92          1.1  christos     ${RELOCATING+*(.gnu.linkonce.d*)}
     93          1.1  christos   }
     94          1.1  christos   . = .;
     95          1.1  christos   ${RELOCATING+ PROVIDE(__Edata = .);}
     96          1.1  christos   /* Deprecated, use __Edata.  */
     97          1.1  christos   ${RELOCATING+ PROVIDE(edata = .);}
     98          1.1  christos   ${RELOCATING+ PROVIDE(_edata = .);}
     99          1.1  christos   ${RELOCATING+ PROVIDE(__edata = .);}
    100          1.1  christos 
    101          1.1  christos   /* At the moment, although perhaps we should, we can't map sections
    102          1.1  christos      without contents to sections *with* contents due to FIXME: a BFD bug.
    103          1.1  christos      Anyway, the mmo back-end ignores sections without contents when
    104          1.1  christos      writing out sections, so this works fine.   */
    105          1.1  christos   .bss :
    106          1.1  christos   {
    107          1.1  christos     ${RELOCATING+ PROVIDE(__Sbss = .);}
    108          1.1  christos     ${RELOCATING+ PROVIDE(__bss_start = .);}
    109          1.1  christos     ${RELOCATING+ *(.sbss);}
    110          1.1  christos     ${RELOCATING+ *(.bss);}
    111          1.1  christos     ${RELOCATING+*(.bss.*)}
    112          1.1  christos     ${RELOCATING+ *(COMMON);}
    113          1.1  christos   }
    114          1.1  christos   . = .;
    115          1.1  christos   ${RELOCATING+ PROVIDE(__Ebss = .);}
    116          1.1  christos 
    117          1.1  christos   /* Deprecated, use __Ebss or __Eall as appropriate.  */
    118          1.1  christos   ${RELOCATING+ PROVIDE(end = .);}
    119          1.1  christos   ${RELOCATING+ PROVIDE(_end = .);}
    120          1.1  christos   ${RELOCATING+ PROVIDE(__end = .);}
    121          1.1  christos   ${RELOCATING+ PROVIDE(__Eall = .);}
    122          1.1  christos 
    123          1.1  christos   .stab 0 : { *(.stab) }
    124          1.1  christos   .stabstr 0 : { *(.stabstr) }
    125          1.1  christos   .stab.excl 0 : { *(.stab.excl) }
    126          1.1  christos   .stab.exclstr 0 : { *(.stab.exclstr) }
    127          1.1  christos   .stab.index 0 : { *(.stab.index) }
    128          1.1  christos   .stab.indexstr 0 : { *(.stab.indexstr) }
    129  1.1.1.1.2.1  pgoyette EOF
    130          1.1  christos 
    131  1.1.1.1.2.1  pgoyette . $srcdir/scripttempl/DWARF.sc
    132          1.1  christos 
    133  1.1.1.1.2.1  pgoyette cat <<EOF
    134          1.1  christos   .MMIX.reg_contents :
    135          1.1  christos   {
    136          1.1  christos     /* Note that this section always has a fixed VMA - that of its
    137          1.1  christos        first register * 8.  */
    138          1.1  christos     *(.MMIX.reg_contents.linker_allocated);
    139          1.1  christos     *(.MMIX.reg_contents);
    140          1.1  christos   }
    141          1.1  christos 
    142          1.1  christos   /* By default, put the high end of the stack where the register stack
    143          1.1  christos      begins.  They grow in opposite directions.  */
    144          1.1  christos   PROVIDE (__Stack_start = 0x6000000000000000);
    145          1.1  christos 
    146          1.1  christos   /* Unfortunately, stabs are not mappable from ELF to MMO.
    147          1.1  christos      It can probably be fixed with some amount of work.  */
    148          1.1  christos   /DISCARD/ :
    149          1.1  christos   { ${RELOCATING+ *(.gnu.warning.*);} }
    150          1.1  christos 
    151          1.1  christos   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
    152          1.1  christos }
    153          1.1  christos EOF
    154