]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/scripttempl/elfmicroblaze.sc
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / scripttempl / elfmicroblaze.sc
CommitLineData
7ba29e2a 1# Adapted from mips.sc
985743c7 2#
250d07de 3# Copyright (C) 2014-2021 Free Software Foundation, Inc.
6c19b93b 4#
985743c7
NC
5# Copying and distribution of this file, with or without modification,
6# are permitted in any medium without royalty provided the copyright
7# notice and this notice are preserved.
8#
7ba29e2a
NC
9# These variables may be overridden by the emulation file. The
10# defaults are appropriate for a DECstation running Ultrix.
985743c7 11
7ba29e2a
NC
12test -z "$ENTRY" && ENTRY=_start
13
14#test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x0"
15
6c19b93b 16CTOR=".ctors ${CONSTRUCTING-0} :
7ba29e2a
NC
17 {
18 ${CONSTRUCTING+${CTOR_START}}
19 /* gcc uses crtbegin.o to find the start of
20 the constructors, so we make sure it is
21 first. Because this is a wildcard, it
22 doesn't matter if the user does not
23 actually link against crtbegin.o; the
24 linker won't look for a file to match a
25 wildcard. The wildcard also means that it
26 doesn't matter which directory crtbegin.o
27 is in. */
28
29 KEEP (*crtbegin.o(.ctors))
30
31 /* We don't want to include the .ctor section from
32 from the crtend.o file until after the sorted ctors.
33 The .ctor section from the crtend file contains the
34 end of ctors marker and it must be last */
35
36 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
37 KEEP (*(SORT(.ctors.*)))
38 KEEP (*(.ctors))
39 ${CONSTRUCTING+${CTOR_END}}
40 }"
41
ec2d9b29 42DTOR=" .dtors ${CONSTRUCTING-0} :
7ba29e2a
NC
43 {
44 ${CONSTRUCTING+${DTOR_START}}
45 KEEP (*crtbegin.o(.dtors))
46 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
47 KEEP (*(SORT(.dtors.*)))
48 KEEP (*(.dtors))
49 ${CONSTRUCTING+${DTOR_END}}
50 }"
51
52cat <<EOF
250d07de 53/* Copyright (C) 2014-2021 Free Software Foundation, Inc.
985743c7
NC
54
55 Copying and distribution of this script, with or without modification,
56 are permitted in any medium without royalty provided the copyright
57 notice and this notice are preserved. */
58
7ba29e2a
NC
59OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
60 "${LITTLE_OUTPUT_FORMAT}")
61/*${LIB_SEARCH_DIRS}*/
62${RELOCATING+${LIB_SEARCH_DIRS}}
63
596d6d91 64${RELOCATING+ENTRY (${ENTRY})}
7ba29e2a 65
2bf2bf23 66${RELOCATING+_TEXT_START_ADDR = DEFINED(_TEXT_START_ADDR) ? _TEXT_START_ADDR : 0x50;
7ba29e2a 67_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x0;
2bf2bf23 68_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x400;}
7ba29e2a
NC
69
70SECTIONS
71{
72 .vectors.reset 0x0 : { KEEP (*(.vectors.reset)) } = 0
73 .vectors.sw_exception 0x8 : { KEEP (*(.vectors.sw_exception)) } = 0
74 .vectors.interrupt 0x10 : { KEEP (*(.vectors.interrupt)) } = 0
75 .vectors.debug_sw_break 0x18 : { KEEP (*(.vectors.debug_sw_break)) } = 0
76 .vectors.hw_exception 0x20 : { KEEP (*(.vectors.hw_exception)) } = 0
77
78 ${RELOCATING+. = _TEXT_START_ADDR;}
79
80 ${RELOCATING+ _ftext = .;}
81 .text : {
2bf2bf23 82 *(.text)
7ba29e2a
NC
83 ${RELOCATING+*(.text.*)}
84 ${RELOCATING+*(.gnu.linkonce.t.*)}
85 }
86 ${RELOCATING+ _etext = .;}
87
2d3181c7
AM
88 .init : { KEEP (*(SORT_NONE(.init))) } =0
89 .fini : { KEEP (*(SORT_NONE(.fini))) } =0
7ba29e2a
NC
90
91 ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);}
92 ${RELOCATING+PROVIDE (___CTOR_LIST__ = .);}
93 ${RELOCATING+${CTOR}}
94 ${RELOCATING+PROVIDE (__CTOR_END__ = .);}
95 ${RELOCATING+PROVIDE (___CTOR_END__ = .);}
96
97 ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);}
98 ${RELOCATING+PROVIDE (___DTOR_LIST__ = .);}
99 ${RELOCATING+${DTOR}}
100 ${RELOCATING+PROVIDE (__DTOR_END__ = .);}
101 ${RELOCATING+PROVIDE (___DTOR_END__ = .);}
102
103 ${RELOCATING+ . = ALIGN(4);}
104 ${RELOCATING+ _frodata = . ;}
105 .rodata : {
2bf2bf23 106 *(.rodata)
7ba29e2a
NC
107 ${RELOCATING+*(.rodata.*)}
108 ${RELOCATING+*(.gnu.linkonce.r.*)}
2bf2bf23 109 ${CONSTRUCTING+CONSTRUCTORS;} /* Is this needed? */
7ba29e2a
NC
110 }
111 ${RELOCATING+ _erodata = .;}
112
113 /* Alignments by 8 to ensure that _SDA2_BASE_ on a word boundary */
114 /* Note that .sdata2 and .sbss2 must be contiguous */
115 ${RELOCATING+. = ALIGN(8);}
116 ${RELOCATING+ _ssrw = .;}
117 .sdata2 : {
2bf2bf23 118 *(.sdata2)
7ba29e2a
NC
119 ${RELOCATING+*(.sdata2.*)}
120 ${RELOCATING+*(.gnu.linkonce.s2.*)}
121 }
122 ${RELOCATING+. = ALIGN(4);}
123 .sbss2 : {
6c19b93b 124 ${RELOCATING+PROVIDE (__sbss2_start = .);}
2bf2bf23 125 *(.sbss2)
7ba29e2a
NC
126 ${RELOCATING+*(.sbss2.*)}
127 ${RELOCATING+*(.gnu.linkonce.sb2.*)}
128 ${RELOCATING+PROVIDE (__sbss2_end = .);}
129 }
130 ${RELOCATING+. = ALIGN(8);}
131 ${RELOCATING+ _essrw = .;}
132 ${RELOCATING+ _ssrw_size = _essrw - _ssrw;}
133 ${RELOCATING+ PROVIDE (_SDA2_BASE_ = _ssrw + (_ssrw_size / 2 ));}
134
135 ${RELOCATING+ . = ALIGN(4);}
136 ${RELOCATING+ _fdata = .;}
137 .data : {
2bf2bf23 138 *(.data)
39d050ee 139 ${RELOCATING+*(.data.*)}
7ba29e2a 140 ${RELOCATING+*(.gnu.linkonce.d.*)}
2bf2bf23 141 ${CONSTRUCTING+CONSTRUCTORS;} /* Is this needed? */
7ba29e2a
NC
142 }
143 ${RELOCATING+ _edata = . ;}
6c19b93b 144
7ba29e2a 145 /* Added to handle pic code */
6c19b93b 146 .got : {
2bf2bf23 147 *(.got)
7ba29e2a
NC
148 }
149
6c19b93b 150 .got1 : {
2bf2bf23 151 *(.got1)
7ba29e2a
NC
152 }
153
6c19b93b 154 .got2 : {
2bf2bf23 155 *(.got2)
7ba29e2a
NC
156 }
157
158 /* Added by Sathya to handle C++ exceptions */
6c19b93b 159 .eh_frame : {
2bf2bf23 160 *(.eh_frame)
7ba29e2a 161 }
6c19b93b
AM
162
163 .jcr : {
2bf2bf23 164 *(.jcr)
7ba29e2a
NC
165 }
166
6c19b93b 167 .gcc_except_table : {
2bf2bf23 168 *(.gcc_except_table)
7ba29e2a
NC
169 }
170
171 /* Alignments by 8 to ensure that _SDA_BASE_ on a word boundary */
172 /* Note that .sdata and .sbss must be contiguous */
173 ${RELOCATING+. = ALIGN(8);}
174 ${RELOCATING+ _ssro = .;}
175 .sdata : {
2bf2bf23 176 *(.sdata)
7ba29e2a
NC
177 ${RELOCATING+*(.sdata.*)}
178 ${RELOCATING+*(.gnu.linkonce.s.*)}
179 }
180 ${RELOCATING+. = ALIGN(4);}
181 .sbss : {
6c19b93b 182 ${RELOCATING+PROVIDE (__sbss_start = .);}
2bf2bf23 183 *(.sbss)
7ba29e2a
NC
184 ${RELOCATING+*(.sbss.*)}
185 ${RELOCATING+*(.gnu.linkonce.sb.*)}
186 ${RELOCATING+PROVIDE (__sbss_end = .);}
187 }
188 ${RELOCATING+. = ALIGN(8);}
189 ${RELOCATING+ _essro = .;}
190 ${RELOCATING+ _ssro_size = _essro - _ssro;}
191 ${RELOCATING+PROVIDE (_SDA_BASE_ = _ssro + (_ssro_size / 2 ));}
192
193 ${RELOCATING+ . = ALIGN(4);}
194 ${RELOCATING+ _fbss = .;}
195 .bss : {
6c19b93b 196 ${RELOCATING+PROVIDE (__bss_start = .);}
2bf2bf23 197 *(.bss)
7ba29e2a
NC
198 ${RELOCATING+*(.bss.*)}
199 ${RELOCATING+*(.gnu.linkonce.b.*)}
200 ${RELOCATING+*(COMMON)}
2edab91c 201 ${RELOCATING+. = ALIGN(. != 0 ? 4 : 1);}
6c19b93b 202
7ba29e2a 203 ${RELOCATING+PROVIDE (__bss_end = .);}
7ba29e2a
NC
204 }
205
206 ${RELOCATING+ . = ALIGN(4);}
207
208 .heap : {
209 ${RELOCATING+ _heap = .;}
210 ${RELOCATING+ _heap_start = .;}
211 ${RELOCATING+ . += _HEAP_SIZE;}
212 ${RELOCATING+ _heap_end = .;}
6c19b93b 213 }
7ba29e2a
NC
214
215 ${RELOCATING+ . = ALIGN(4);}
216
217 .stack : {
218 ${RELOCATING+ _stack_end = .;}
219 ${RELOCATING+ . += _STACK_SIZE;}
2edab91c 220 ${RELOCATING+ . = ALIGN(. != 0 ? 8 : 1);}
7ba29e2a
NC
221 ${RELOCATING+ _stack = .;}
222 ${RELOCATING+ _end = .;}
223 }
224
6c19b93b 225 .tdata : {
2bf2bf23 226 *(.tdata)
7ba29e2a
NC
227 ${RELOCATING+*(.tdata.*)}
228 ${RELOCATING+*(.gnu.linkonce.td.*)}
229 }
6c19b93b 230 .tbss : {
2bf2bf23 231 *(.tbss)
7ba29e2a
NC
232 ${RELOCATING+*(.tbss.*)}
233 ${RELOCATING+*(.gnu.linkonce.tb.*)}
234 }
235}
236EOF