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