]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/scripttempl/mmo.sc
gdb/
[thirdparty/binutils-gdb.git] / ld / scripttempl / mmo.sc
CommitLineData
18c32df5
HPN
1# MMO is not a relocateable format, and we don't want to require an
2# explicit (e.g.) "-m elf64mmix" when -r is used.
3test -z $RELOCATEABLE_OUTPUT_FORMAT && RELOCATEABLE_OUTPUT_FORMAT=$OUTPUT_FORMAT
4test -z ${RELOCATING+0} && OUTPUT_FORMAT=$RELOCATEABLE_OUTPUT_FORMAT
3c3bdf30 5cat <<EOF
18c32df5 6OUTPUT_FORMAT("$OUTPUT_FORMAT")
3c3bdf30 7OUTPUT_ARCH(mmix)
18c32df5 8${RELOCATING+ENTRY(Main)}
3c3bdf30
NC
9SECTIONS
10{
11 .text ${RELOCATING+ ${TEXT_START_ADDR}}:
12 {
13 *(.text)
14 ${RELOCATING+*(.text.*)}
15 ${RELOCATING+*(.gnu.linkonce.t*)}
16 ${RELOCATING+*(.rodata)}
17 ${RELOCATING+*(.rodata.*)}
18 ${RELOCATING+*(.gnu.linkonce.r*)}
19
20 /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections. */
21 ${RELOCATING+ PROVIDE (_init_start = .);}
22 ${RELOCATING+ PROVIDE (_init = .);}
a9ae0bda 23 ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
3c3bdf30
NC
24 ${RELOCATING+ PROVIDE (_init_end = .);}
25
26 ${RELOCATING+ PROVIDE (_fini_start = .);}
27 ${RELOCATING+ PROVIDE (_fini = .);}
a9ae0bda 28 ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
3c3bdf30
NC
29 ${RELOCATING+ PROVIDE (_fini_end = .);}
30
31 /* FIXME: Align ctors, dtors, ehframe. */
32 ${RELOCATING+ PROVIDE (_ctors_start = .);}
33 ${RELOCATING+ PROVIDE (__ctors_start = .);}
34 ${RELOCATING+ PROVIDE (_ctors = .);}
35 ${RELOCATING+ PROVIDE (__ctors = .);}
40cf2291
AM
36 ${RELOCATING+ KEEP (*crtbegin.o(.ctors))}
37 ${RELOCATING+ KEEP (*crtbegin?.o(.ctors))}
38 ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
3c3bdf30
NC
39 ${RELOCATING+ KEEP (*(SORT(.ctors.*)))}
40 ${RELOCATING+ KEEP (*(.ctors))}
41 ${RELOCATING+ PROVIDE (_ctors_end = .);}
42 ${RELOCATING+ PROVIDE (__ctors_end = .);}
43
44 ${RELOCATING+ PROVIDE (_dtors_start = .);}
45 ${RELOCATING+ PROVIDE (__dtors_start = .);}
46 ${RELOCATING+ PROVIDE (_dtors = .);}
47 ${RELOCATING+ PROVIDE (__dtors = .);}
40cf2291
AM
48 ${RELOCATING+ KEEP (*crtbegin.o(.dtors))}
49 ${RELOCATING+ KEEP (*crtbegin?.o(.dtors))}
50 ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
3c3bdf30
NC
51 ${RELOCATING+ KEEP (*(SORT(.dtors.*)))}
52 ${RELOCATING+ KEEP (*(.dtors))}
53 ${RELOCATING+ PROVIDE (_dtors_end = .);}
54 ${RELOCATING+ PROVIDE (__dtors_end = .);}
55
56 ${RELOCATING+KEEP (*(.jcr))}
57 ${RELOCATING+KEEP (*(.eh_frame))}
58 ${RELOCATING+*(.gcc_except_table)}
59
6be999b8 60 ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : ADDR (.text));}
3c3bdf30 61 }
3c3bdf30 62
a9ae0bda
HPN
63 /* The following NOP assignment and those after .data and .bss, are
64 necessary to get orphan sections adopted by the .text inserted before
65 the following end-section symbols. An output section would also serve
66 this purpose, but we can't do that. */
67 . = .;
68 ${RELOCATING+ PROVIDE(etext = .);}
69 ${RELOCATING+ PROVIDE(_etext = .);}
70 ${RELOCATING+ PROVIDE(__etext = .);}
2a995fc1 71
3c3bdf30
NC
72 .data ${RELOCATING+ ${DATA_ADDR}}:
73 {
74 ${RELOCATING+ PROVIDE(__Sdata = .);}
75
76 *(.data);
77 ${RELOCATING+*(.data.*)}
78 ${RELOCATING+*(.gnu.linkonce.d*)}
3c3bdf30 79 }
a9ae0bda
HPN
80 . = .;
81 ${RELOCATING+ PROVIDE(__Edata = .);}
82 /* Deprecated, use __Edata. */
83 ${RELOCATING+ PROVIDE(edata = .);}
84 ${RELOCATING+ PROVIDE(_edata = .);}
85 ${RELOCATING+ PROVIDE(__edata = .);}
3c3bdf30
NC
86
87 /* At the moment, although perhaps we should, we can't map sections
88 without contents to sections *with* contents due to FIXME: a BFD bug.
89 Anyway, the mmo back-end ignores sections without contents when
90 writing out sections, so this works fine. */
91 .bss :
92 {
93 ${RELOCATING+ PROVIDE(__Sbss = .);}
94 ${RELOCATING+ PROVIDE(__bss_start = .);}
95 ${RELOCATING+ *(.sbss);}
96 ${RELOCATING+ *(.bss);}
97 ${RELOCATING+*(.bss.*)}
98 ${RELOCATING+ *(COMMON);}
3c3bdf30 99 }
a9ae0bda
HPN
100 . = .;
101 ${RELOCATING+ PROVIDE(__Ebss = .);}
3c3bdf30
NC
102
103 /* Deprecated, use __Ebss or __Eall as appropriate. */
104 ${RELOCATING+ PROVIDE(end = .);}
105 ${RELOCATING+ PROVIDE(_end = .);}
106 ${RELOCATING+ PROVIDE(__end = .);}
107 ${RELOCATING+ PROVIDE(__Eall = .);}
108
a9ae0bda
HPN
109 .stab 0 : { *(.stab) }
110 .stabstr 0 : { *(.stabstr) }
111 .stab.excl 0 : { *(.stab.excl) }
112 .stab.exclstr 0 : { *(.stab.exclstr) }
113 .stab.index 0 : { *(.stab.index) }
114 .stab.indexstr 0 : { *(.stab.indexstr) }
ceb0a680
NC
115EOF
116
117source $srcdir/scripttempl/DWARF.sc
a9ae0bda 118
ceb0a680 119cat <<EOF
3c3bdf30
NC
120 .MMIX.reg_contents :
121 {
122 /* Note that this section always has a fixed VMA - that of its
123 first register * 8. */
48fa4a5d 124 *(.MMIX.reg_contents.linker_allocated);
3c3bdf30
NC
125 *(.MMIX.reg_contents);
126 }
127
128 /* By default, put the high end of the stack where the register stack
129 begins. They grow in opposite directions. */
130 PROVIDE (__Stack_start = 0x6000000000000000);
131
132 /* Unfortunately, stabs are not mappable from ELF to MMO.
133 It can probably be fixed with some amount of work. */
134 /DISCARD/ :
18c32df5 135 { ${RELOCATING+ *(.gnu.warning.*);} }
a9ae0bda
HPN
136
137 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
3c3bdf30
NC
138}
139EOF