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