1 # Copyright (C) 2014-2019 Free Software Foundation, Inc.
3 # Copying and distribution of this file, with or without modification,
4 # are permitted in any medium without royalty provided the copyright
5 # notice and this notice are preserved.
7 # MMO is not a relocateable format, and we don't want to require an
8 # explicit (e.g.) "-m elf64mmix" when -r is used.
10 test -z $RELOCATEABLE_OUTPUT_FORMAT && RELOCATEABLE_OUTPUT_FORMAT=$OUTPUT_FORMAT
11 test -z ${RELOCATING+0} && OUTPUT_FORMAT=$RELOCATEABLE_OUTPUT_FORMAT
14 /* Copyright (C) 2014-2019 Free Software Foundation, Inc.
16 Copying and distribution of this script, with or without modification,
17 are permitted in any medium without royalty provided the copyright
18 notice and this notice are preserved. */
20 OUTPUT_FORMAT("$OUTPUT_FORMAT")
22 ${RELOCATING+ENTRY(Main)}
25 .text ${RELOCATING+ ${TEXT_START_ADDR}}:
28 ${RELOCATING+*(.text.*)}
29 ${RELOCATING+*(.gnu.linkonce.t*)}
30 ${RELOCATING+*(.rodata)}
31 ${RELOCATING+*(.rodata.*)}
32 ${RELOCATING+*(.gnu.linkonce.r*)}
34 /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections. */
35 ${RELOCATING+ PROVIDE (_init_start = .);}
36 ${RELOCATING+ PROVIDE (_init = .);}
37 ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
38 ${RELOCATING+ PROVIDE (_init_end = .);}
40 ${RELOCATING+ PROVIDE (_fini_start = .);}
41 ${RELOCATING+ PROVIDE (_fini = .);}
42 ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
43 ${RELOCATING+ PROVIDE (_fini_end = .);}
45 /* FIXME: Align ctors, dtors, ehframe. */
46 ${RELOCATING+ PROVIDE (_ctors_start = .);}
47 ${RELOCATING+ PROVIDE (__ctors_start = .);}
48 ${RELOCATING+ PROVIDE (_ctors = .);}
49 ${RELOCATING+ PROVIDE (__ctors = .);}
50 ${RELOCATING+ KEEP (*crtbegin.o(.ctors))}
51 ${RELOCATING+ KEEP (*crtbegin?.o(.ctors))}
52 ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
53 ${RELOCATING+ KEEP (*(SORT(.ctors.*)))}
54 ${RELOCATING+ KEEP (*(.ctors))}
55 ${RELOCATING+ PROVIDE (_ctors_end = .);}
56 ${RELOCATING+ PROVIDE (__ctors_end = .);}
58 ${RELOCATING+ PROVIDE (_dtors_start = .);}
59 ${RELOCATING+ PROVIDE (__dtors_start = .);}
60 ${RELOCATING+ PROVIDE (_dtors = .);}
61 ${RELOCATING+ PROVIDE (__dtors = .);}
62 ${RELOCATING+ KEEP (*crtbegin.o(.dtors))}
63 ${RELOCATING+ KEEP (*crtbegin?.o(.dtors))}
64 ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
65 ${RELOCATING+ KEEP (*(SORT(.dtors.*)))}
66 ${RELOCATING+ KEEP (*(.dtors))}
67 ${RELOCATING+ PROVIDE (_dtors_end = .);}
68 ${RELOCATING+ PROVIDE (__dtors_end = .);}
70 ${RELOCATING+KEEP (*(.jcr))}
71 ${RELOCATING+KEEP (*(.eh_frame))}
72 ${RELOCATING+*(.gcc_except_table)}
74 ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : ADDR (.text));}
77 /* The following NOP assignment and those after .data and .bss, are
78 necessary to get orphan sections adopted by the .text inserted before
79 the following end-section symbols. An output section would also serve
80 this purpose, but we can't do that. */
82 ${RELOCATING+ PROVIDE(etext = .);}
83 ${RELOCATING+ PROVIDE(_etext = .);}
84 ${RELOCATING+ PROVIDE(__etext = .);}
86 .data ${RELOCATING+ ${DATA_ADDR}}:
88 ${RELOCATING+ PROVIDE(__Sdata = .);}
91 ${RELOCATING+*(.data.*)}
92 ${RELOCATING+*(.gnu.linkonce.d*)}
95 ${RELOCATING+ PROVIDE(__Edata = .);}
96 /* Deprecated, use __Edata. */
97 ${RELOCATING+ PROVIDE(edata = .);}
98 ${RELOCATING+ PROVIDE(_edata = .);}
99 ${RELOCATING+ PROVIDE(__edata = .);}
101 /* At the moment, although perhaps we should, we can't map sections
102 without contents to sections *with* contents due to FIXME: a BFD bug.
103 Anyway, the mmo back-end ignores sections without contents when
104 writing out sections, so this works fine. */
107 ${RELOCATING+ PROVIDE(__Sbss = .);}
108 ${RELOCATING+ PROVIDE(__bss_start = .);}
109 ${RELOCATING+ *(.sbss);}
110 ${RELOCATING+ *(.bss);}
111 ${RELOCATING+*(.bss.*)}
112 ${RELOCATING+ *(COMMON);}
115 ${RELOCATING+ PROVIDE(__Ebss = .);}
117 /* Deprecated, use __Ebss or __Eall as appropriate. */
118 ${RELOCATING+ PROVIDE(end = .);}
119 ${RELOCATING+ PROVIDE(_end = .);}
120 ${RELOCATING+ PROVIDE(__end = .);}
121 ${RELOCATING+ PROVIDE(__Eall = .);}
123 .stab 0 : { *(.stab) }
124 .stabstr 0 : { *(.stabstr) }
125 .stab.excl 0 : { *(.stab.excl) }
126 .stab.exclstr 0 : { *(.stab.exclstr) }
127 .stab.index 0 : { *(.stab.index) }
128 .stab.indexstr 0 : { *(.stab.indexstr) }
131 . $srcdir/scripttempl/DWARF.sc
136 /* Note that this section always has a fixed VMA - that of its
137 first register * 8. */
138 *(.MMIX.reg_contents.linker_allocated);
139 *(.MMIX.reg_contents);
142 ${RELOCATING+/* By default, put the high end of the stack where the register stack
143 begins. They grow in opposite directions. */
144 PROVIDE (__Stack_start = 0x6000000000000000);}
146 /* Unfortunately, stabs are not mappable from ELF to MMO.
147 It can probably be fixed with some amount of work. */
149 { ${RELOCATING+ *(.gnu.warning.*);} }
151 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }