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