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