Add MMIX support
[external/binutils.git] / ld / scripttempl / mmo.sc
1 cat <<EOF
2 OUTPUT_FORMAT("mmo")
3 OUTPUT_ARCH(mmix)
4 ENTRY(Main)
5 SECTIONS
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+ *(.init)}
20     ${RELOCATING+ PROVIDE (_init_end = .);}
21
22     ${RELOCATING+ PROVIDE (_fini_start = .);}
23     ${RELOCATING+ PROVIDE (_fini = .);}
24     ${RELOCATING+ *(.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 : . - SIZEOF (.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
76   .data ${RELOCATING+ ${DATA_ADDR}}:
77   {
78     ${RELOCATING+ PROVIDE(__Sdata = .);}
79
80     *(.data);
81     ${RELOCATING+*(.data.*)}
82     ${RELOCATING+*(.gnu.linkonce.d*)}
83
84     ${RELOCATING+ PROVIDE(__Edata = .);}
85
86     /* Deprecated, use __Edata.  */
87     ${RELOCATING+ PROVIDE(edata = .);}
88     ${RELOCATING+ PROVIDE(_edata = .);}
89     ${RELOCATING+ PROVIDE(__edata = .);}
90   }
91
92   /* At the moment, although perhaps we should, we can't map sections
93      without contents to sections *with* contents due to FIXME: a BFD bug.
94      Anyway, the mmo back-end ignores sections without contents when
95      writing out sections, so this works fine.   */
96   .bss :
97   {
98     ${RELOCATING+ PROVIDE(__Sbss = .);}
99     ${RELOCATING+ PROVIDE(__bss_start = .);}
100     ${RELOCATING+ *(.sbss);}
101     ${RELOCATING+ *(.bss);}
102     ${RELOCATING+*(.bss.*)}
103     ${RELOCATING+ *(COMMON);}
104     ${RELOCATING+ PROVIDE(__Ebss = .);}
105   }
106
107   /* Deprecated, use __Ebss or __Eall as appropriate.  */
108   ${RELOCATING+ PROVIDE(end = .);}
109   ${RELOCATING+ PROVIDE(_end = .);}
110   ${RELOCATING+ PROVIDE(__end = .);}
111   ${RELOCATING+ PROVIDE(__Eall = .);}
112
113   .MMIX.reg_contents :
114   {
115     /* Note that this section always has a fixed VMA - that of its
116        first register * 8.  */
117     *(.MMIX.reg_contents);
118   }
119
120   /* By default, put the high end of the stack where the register stack
121      begins.  They grow in opposite directions.  */
122   PROVIDE (__Stack_start = 0x6000000000000000);
123
124   /* Unfortunately, stabs are not mappable from ELF to MMO.
125      It can probably be fixed with some amount of work.  */
126   /DISCARD/ :
127   { *(.gnu.warning.*); }
128 }
129 EOF