]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/scripttempl/mmo.sc
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / scripttempl / mmo.sc
CommitLineData
a2c58332 1# Copyright (C) 2014-2022 Free Software Foundation, Inc.
6c19b93b 2#
985743c7
NC
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.
6
18c32df5
HPN
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.
985743c7 9
18c32df5
HPN
10test -z $RELOCATEABLE_OUTPUT_FORMAT && RELOCATEABLE_OUTPUT_FORMAT=$OUTPUT_FORMAT
11test -z ${RELOCATING+0} && OUTPUT_FORMAT=$RELOCATEABLE_OUTPUT_FORMAT
985743c7 12
3c3bdf30 13cat <<EOF
a2c58332 14/* Copyright (C) 2014-2022 Free Software Foundation, Inc.
985743c7
NC
15
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. */
19
18c32df5 20OUTPUT_FORMAT("$OUTPUT_FORMAT")
3c3bdf30 21OUTPUT_ARCH(mmix)
18c32df5 22${RELOCATING+ENTRY(Main)}
3c3bdf30
NC
23SECTIONS
24{
25 .text ${RELOCATING+ ${TEXT_START_ADDR}}:
26 {
555a5789
HPN
27 /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections. */
28 ${RELOCATING+ PROVIDE (_init_start = .);}
29 ${RELOCATING+ PROVIDE (_init = .);}
30 ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
31 ${RELOCATING+ PROVIDE (_init_end = .);}
32
3c3bdf30
NC
33 *(.text)
34 ${RELOCATING+*(.text.*)}
35 ${RELOCATING+*(.gnu.linkonce.t*)}
36 ${RELOCATING+*(.rodata)}
37 ${RELOCATING+*(.rodata.*)}
38 ${RELOCATING+*(.gnu.linkonce.r*)}
39
3c3bdf30
NC
40 ${RELOCATING+ PROVIDE (_fini_start = .);}
41 ${RELOCATING+ PROVIDE (_fini = .);}
a9ae0bda 42 ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
3c3bdf30
NC
43 ${RELOCATING+ PROVIDE (_fini_end = .);}
44
45 /* FIXME: Align ctors, dtors, ehframe. */
46 ${RELOCATING+ PROVIDE (_ctors_start = .);}
47 ${RELOCATING+ PROVIDE (__ctors_start = .);}
48 ${RELOCATING+ PROVIDE (_ctors = .);}
49 ${RELOCATING+ PROVIDE (__ctors = .);}
40cf2291
AM
50 ${RELOCATING+ KEEP (*crtbegin.o(.ctors))}
51 ${RELOCATING+ KEEP (*crtbegin?.o(.ctors))}
52 ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
3c3bdf30
NC
53 ${RELOCATING+ KEEP (*(SORT(.ctors.*)))}
54 ${RELOCATING+ KEEP (*(.ctors))}
55 ${RELOCATING+ PROVIDE (_ctors_end = .);}
56 ${RELOCATING+ PROVIDE (__ctors_end = .);}
57
58 ${RELOCATING+ PROVIDE (_dtors_start = .);}
59 ${RELOCATING+ PROVIDE (__dtors_start = .);}
60 ${RELOCATING+ PROVIDE (_dtors = .);}
61 ${RELOCATING+ PROVIDE (__dtors = .);}
40cf2291
AM
62 ${RELOCATING+ KEEP (*crtbegin.o(.dtors))}
63 ${RELOCATING+ KEEP (*crtbegin?.o(.dtors))}
64 ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
3c3bdf30
NC
65 ${RELOCATING+ KEEP (*(SORT(.dtors.*)))}
66 ${RELOCATING+ KEEP (*(.dtors))}
67 ${RELOCATING+ PROVIDE (_dtors_end = .);}
68 ${RELOCATING+ PROVIDE (__dtors_end = .);}
69
70 ${RELOCATING+KEEP (*(.jcr))}
71 ${RELOCATING+KEEP (*(.eh_frame))}
72 ${RELOCATING+*(.gcc_except_table)}
73
6be999b8 74 ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : ADDR (.text));}
3c3bdf30 75 }
3c3bdf30 76
a9ae0bda
HPN
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. */
81 . = .;
82 ${RELOCATING+ PROVIDE(etext = .);}
83 ${RELOCATING+ PROVIDE(_etext = .);}
84 ${RELOCATING+ PROVIDE(__etext = .);}
2a995fc1 85
3c3bdf30
NC
86 .data ${RELOCATING+ ${DATA_ADDR}}:
87 {
88 ${RELOCATING+ PROVIDE(__Sdata = .);}
89
90 *(.data);
91 ${RELOCATING+*(.data.*)}
92 ${RELOCATING+*(.gnu.linkonce.d*)}
3c3bdf30 93 }
a9ae0bda
HPN
94 . = .;
95 ${RELOCATING+ PROVIDE(__Edata = .);}
96 /* Deprecated, use __Edata. */
97 ${RELOCATING+ PROVIDE(edata = .);}
98 ${RELOCATING+ PROVIDE(_edata = .);}
99 ${RELOCATING+ PROVIDE(__edata = .);}
3c3bdf30
NC
100
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. */
105 .bss :
106 {
107 ${RELOCATING+ PROVIDE(__Sbss = .);}
108 ${RELOCATING+ PROVIDE(__bss_start = .);}
109 ${RELOCATING+ *(.sbss);}
110 ${RELOCATING+ *(.bss);}
111 ${RELOCATING+*(.bss.*)}
112 ${RELOCATING+ *(COMMON);}
3c3bdf30 113 }
a9ae0bda
HPN
114 . = .;
115 ${RELOCATING+ PROVIDE(__Ebss = .);}
3c3bdf30
NC
116
117 /* Deprecated, use __Ebss or __Eall as appropriate. */
118 ${RELOCATING+ PROVIDE(end = .);}
119 ${RELOCATING+ PROVIDE(_end = .);}
120 ${RELOCATING+ PROVIDE(__end = .);}
121 ${RELOCATING+ PROVIDE(__Eall = .);}
122
a9ae0bda
HPN
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) }
ceb0a680
NC
129EOF
130
d061dfac 131. $srcdir/scripttempl/DWARF.sc
a9ae0bda 132
ceb0a680 133cat <<EOF
3c3bdf30
NC
134 .MMIX.reg_contents :
135 {
136 /* Note that this section always has a fixed VMA - that of its
137 first register * 8. */
48fa4a5d 138 *(.MMIX.reg_contents.linker_allocated);
3c3bdf30
NC
139 *(.MMIX.reg_contents);
140 }
141
2bf2bf23 142 ${RELOCATING+/* By default, put the high end of the stack where the register stack
3c3bdf30 143 begins. They grow in opposite directions. */
2bf2bf23 144 PROVIDE (__Stack_start = 0x6000000000000000);}
3c3bdf30
NC
145
146 /* Unfortunately, stabs are not mappable from ELF to MMO.
147 It can probably be fixed with some amount of work. */
148 /DISCARD/ :
18c32df5 149 { ${RELOCATING+ *(.gnu.warning.*);} }
a9ae0bda
HPN
150
151 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
3c3bdf30
NC
152}
153EOF