Commit | Line | Data |
---|---|---|
886a2506 NC |
1 | # |
2 | # Unusual variables checked by this code: | |
3 | # NOP - four byte opcode for no-op (defaults to 0) | |
4 | # NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not | |
5 | # empty. | |
6 | # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start | |
7 | # INITIAL_READONLY_SECTIONS - at start of text segment | |
8 | # OTHER_READONLY_SECTIONS - other than .text .init .rodata ... | |
9 | # (e.g., .PARISC.milli) | |
10 | # OTHER_TEXT_SECTIONS - these get put in .text when relocating | |
11 | # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... | |
12 | # (e.g., .PARISC.global) | |
13 | # OTHER_BSS_SECTIONS - other than .bss .sbss ... | |
14 | # OTHER_SECTIONS - at the end | |
15 | # EXECUTABLE_SYMBOLS - symbols that must be defined for an | |
16 | # executable (e.g., _DYNAMIC_LINK) | |
17 | # TEXT_START_SYMBOLS - symbols that appear at the start of the | |
18 | # .text section. | |
19 | # DATA_START_SYMBOLS - symbols that appear at the start of the | |
20 | # .data section. | |
21 | # OTHER_GOT_SYMBOLS - symbols defined just before .got. | |
22 | # OTHER_GOT_SECTIONS - sections just after .got. | |
23 | # OTHER_SDATA_SECTIONS - sections just after .sdata. | |
24 | # OTHER_BSS_SYMBOLS - symbols that appear at the start of the | |
25 | # .bss section besides __bss_start. | |
26 | # DATA_PLT - .plt should be in data segment, not text segment. | |
27 | # BSS_PLT - .plt should be in bss segment | |
28 | # TEXT_DYNAMIC - .dynamic in text segment, not data segment. | |
6c19b93b | 29 | # EMBEDDED - whether this is for an embedded system. |
886a2506 NC |
30 | # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set |
31 | # start address of shared library. | |
32 | # INPUT_FILES - INPUT command of files to always include | |
33 | # WRITABLE_RODATA - if set, the .rodata section should be writable | |
34 | # INIT_START, INIT_END - statements just before and just after | |
6c19b93b | 35 | # combination of .init sections. |
886a2506 | 36 | # FINI_START, FINI_END - statements just before and just after |
6c19b93b | 37 | # combination of .fini sections. |
886a2506 NC |
38 | # STACK_ADDR - start of a .stack section. |
39 | # OTHER_END_SYMBOLS - symbols to place right at the end of the script. | |
40 | # | |
41 | # When adding sections, do note that the names of some sections are used | |
42 | # when specifying the start address of the next. | |
43 | # | |
44 | ||
45 | # Many sections come in three flavours. There is the 'real' section, | |
46 | # like ".data". Then there are the per-procedure or per-variable | |
47 | # sections, generated by -ffunction-sections and -fdata-sections in GCC, | |
48 | # and useful for --gc-sections, which for a variable "foo" might be | |
49 | # ".data.foo". Then there are the linkonce sections, for which the linker | |
50 | # eliminates duplicates, which are named like ".gnu.linkonce.d.foo". | |
51 | # The exact correspondences are: | |
52 | # | |
53 | # Section Linkonce section | |
54 | # .text .gnu.linkonce.t.foo | |
55 | # .rodata .gnu.linkonce.r.foo | |
56 | # .data .gnu.linkonce.d.foo | |
57 | # .bss .gnu.linkonce.b.foo | |
58 | # .sdata .gnu.linkonce.s.foo | |
59 | # .sbss .gnu.linkonce.sb.foo | |
60 | # .sdata2 .gnu.linkonce.s2.foo | |
61 | # .sbss2 .gnu.linkonce.sb2.foo | |
62 | # .debug_info .gnu.linkonce.wi.foo | |
63 | # .tdata .gnu.linkonce.td.foo | |
64 | # .tbss .gnu.linkonce.tb.foo | |
65 | # | |
66 | # Each of these can also have corresponding .rel.* and .rela.* sections. | |
67 | ||
68 | test -z "$ENTRY" && ENTRY=start | |
69 | test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
70 | test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
71 | # If we request a big endian toolchain, give a big endian linker | |
72 | test "${ARC_ENDIAN}" == "big" && OUTPUT_FORMAT=${BIG_OUTPUT_FORMAT} | |
73 | if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi | |
74 | test -z "${ELFSIZE}" && ELFSIZE=32 | |
75 | test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8" | |
76 | test "$LD_FLAG" = "N" && DATA_ADDR=. | |
77 | test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE="" | |
78 | test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE="" | |
79 | DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" | |
80 | DATA_SEGMENT_END="" | |
81 | if test -n "${COMMONPAGESIZE}"; then | |
82 | DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" | |
83 | DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);" | |
84 | fi | |
85 | INTERP=".interp ${RELOCATING-0} : { *(.interp) }" | |
86 | PLT=".plt ${RELOCATING-0} : { *(.plt) }" | |
2bf2bf23 | 87 | test -z "$GOT" && GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }" |
886a2506 NC |
88 | DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" |
89 | RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" | |
90 | STACKNOTE="/DISCARD/ : { *(.note.GNU-stack) }" | |
91 | if test -z "${NO_SMALL_DATA}"; then | |
92 | SBSS=".sbss ${RELOCATING-0} : | |
93 | { | |
94 | ${RELOCATING+PROVIDE (__sbss_start = .);} | |
95 | ${RELOCATING+PROVIDE (___sbss_start = .);} | |
2bf2bf23 | 96 | ${RELOCATING+*(.dynsbss)} |
886a2506 | 97 | *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*}) |
2bf2bf23 | 98 | ${RELOCATING+*(.scommon)} |
886a2506 NC |
99 | ${RELOCATING+PROVIDE (__sbss_end = .);} |
100 | ${RELOCATING+PROVIDE (___sbss_end = .);} | |
101 | }" | |
102 | SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }" | |
103 | SDATA="/* We want the small data sections together, so single-instruction offsets | |
104 | can access them all, and initialized data all before uninitialized, so | |
105 | we can shorten the on-disk segment size. */ | |
6c19b93b | 106 | .sdata ${RELOCATING-0} : |
886a2506 NC |
107 | { |
108 | ${RELOCATING+${SDATA_START_SYMBOLS}} | |
109 | *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*}) | |
110 | }" | |
111 | SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) }" | |
112 | REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) } | |
113 | .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }" | |
114 | REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) } | |
115 | .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }" | |
116 | REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) } | |
117 | .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }" | |
118 | REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) } | |
119 | .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }" | |
120 | fi | |
6c19b93b | 121 | CTOR=".ctors ${CONSTRUCTING-0} : |
886a2506 NC |
122 | { |
123 | ${CONSTRUCTING+${CTOR_START}} | |
124 | /* gcc uses crtbegin.o to find the start of | |
125 | the constructors, so we make sure it is | |
126 | first. Because this is a wildcard, it | |
127 | doesn't matter if the user does not | |
128 | actually link against crtbegin.o; the | |
129 | linker won't look for a file to match a | |
130 | wildcard. The wildcard also means that it | |
131 | doesn't matter which directory crtbegin.o | |
132 | is in. */ | |
133 | ||
134 | KEEP (*crtbegin*.o(.ctors)) | |
135 | ||
136 | /* We don't want to include the .ctor section from | |
137 | from the crtend.o file until after the sorted ctors. | |
138 | The .ctor section from the crtend file contains the | |
139 | end of ctors marker and it must be last */ | |
140 | ||
141 | KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) | |
142 | KEEP (*(SORT(.ctors.*))) | |
143 | KEEP (*(.ctors)) | |
144 | ${CONSTRUCTING+${CTOR_END}} | |
145 | }" | |
146 | DTOR=".dtors ${CONSTRUCTING-0} : | |
147 | { | |
148 | ${CONSTRUCTING+${DTOR_START}} | |
149 | KEEP (*crtbegin*.o(.dtors)) | |
150 | KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) | |
151 | KEEP (*(SORT(.dtors.*))) | |
152 | KEEP (*(.dtors)) | |
153 | ${CONSTRUCTING+${DTOR_END}} | |
154 | }" | |
155 | STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : | |
156 | { | |
157 | ${RELOCATING+_stack = .;} | |
158 | *(.stack) | |
159 | }" | |
160 | ||
161 | # if this is for an embedded system, don't add SIZEOF_HEADERS. | |
162 | if [ -z "$EMBEDDED" ]; then | |
163 | test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS" | |
164 | else | |
165 | test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}" | |
166 | fi | |
167 | ||
168 | cat <<EOF | |
169 | OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", | |
170 | "${LITTLE_OUTPUT_FORMAT}") | |
171 | OUTPUT_ARCH(${OUTPUT_ARCH}) | |
172 | ${RELOCATING+ENTRY(${ENTRY})} | |
173 | ||
174 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
175 | ${RELOCATING+/* Do we need any of these for elf? | |
176 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} | |
177 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} | |
178 | ${RELOCATING+${INPUT_FILES}} | |
179 | ${RELOCATING- /* For some reason, the Solaris linker makes bad executables | |
180 | if gld -r is used and the intermediate file has sections starting | |
181 | at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld | |
182 | bug. But for now assigning the zero vmas works. */} | |
183 | ||
184 | SECTIONS | |
185 | { | |
186 | /* Read-only sections, merged into text segment: */ | |
187 | ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}} | |
188 | ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} | |
189 | ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} | |
190 | ${CREATE_SHLIB-${INTERP}} | |
191 | ${INITIAL_READONLY_SECTIONS} | |
192 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
193 | .hash ${RELOCATING-0} : { *(.hash) } | |
194 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
195 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
196 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
197 | .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) } | |
198 | .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) } | |
199 | ||
200 | EOF | |
201 | if [ "x$COMBRELOC" = x ]; then | |
202 | COMBRELOCCAT=cat | |
203 | else | |
204 | COMBRELOCCAT="cat > $COMBRELOC" | |
205 | fi | |
206 | eval $COMBRELOCCAT <<EOF | |
207 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
208 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
209 | .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) } | |
210 | .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) } | |
211 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } | |
212 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
213 | .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) } | |
214 | .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) } | |
215 | ${OTHER_READONLY_RELOC_SECTIONS} | |
216 | .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) } | |
217 | .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) } | |
218 | .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) } | |
219 | .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) } | |
220 | .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) } | |
221 | .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) } | |
222 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } | |
223 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
224 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
225 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
226 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
227 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
228 | ${OTHER_GOT_RELOC_SECTIONS} | |
229 | ${REL_SDATA} | |
230 | ${REL_SBSS} | |
231 | ${REL_SDATA2} | |
232 | ${REL_SBSS2} | |
233 | .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) } | |
234 | .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) } | |
235 | EOF | |
236 | if [ -n "$COMBRELOC" ]; then | |
237 | cat <<EOF | |
238 | .rel.dyn ${RELOCATING-0} : | |
239 | { | |
240 | EOF | |
6c19b93b | 241 | sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC |
886a2506 NC |
242 | cat <<EOF |
243 | } | |
244 | .rela.dyn ${RELOCATING-0} : | |
245 | { | |
246 | EOF | |
6c19b93b | 247 | sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC |
886a2506 NC |
248 | cat <<EOF |
249 | } | |
250 | EOF | |
251 | fi | |
252 | cat <<EOF | |
253 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
254 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
255 | ${OTHER_PLT_RELOC_SECTIONS} | |
256 | ||
6c19b93b AM |
257 | .init ${RELOCATING-0} : |
258 | { | |
886a2506 | 259 | ${RELOCATING+${INIT_START}} |
2d3181c7 | 260 | KEEP (*(SORT_NONE(.init))) |
886a2506 NC |
261 | ${RELOCATING+${INIT_END}} |
262 | } =${NOP-0} | |
263 | ||
264 | ${DATA_PLT-${BSS_PLT-${PLT}}} | |
684d5a10 JEM |
265 | .jlitab ${RELOCATING-0} : |
266 | { | |
267 | ${RELOCATING+${JLI_START_TABLE}} | |
2bf2bf23 AM |
268 | ${RELOCATING+jlitab*.o(.jlitab*)} |
269 | *(.jlitab${RELOCATING+*}) | |
684d5a10 | 270 | } =${NOP-0} |
886a2506 NC |
271 | .text ${RELOCATING-0} : |
272 | { | |
273 | ${RELOCATING+${TEXT_START_SYMBOLS}} | |
274 | *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*}) | |
075a2b89 | 275 | /* .gnu.warning sections are handled specially by elf.em. */ |
886a2506 NC |
276 | *(.gnu.warning) |
277 | ${RELOCATING+${OTHER_TEXT_SECTIONS}} | |
278 | } =${NOP-0} | |
279 | .text.init ${RELOCATING-0} : | |
280 | { | |
281 | *(.text.init) | |
282 | } =${NOP-0} | |
283 | .fini ${RELOCATING-0} : | |
284 | { | |
285 | ${RELOCATING+${FINI_START}} | |
2d3181c7 | 286 | KEEP (*(SORT_NONE(.fini))) |
886a2506 NC |
287 | ${RELOCATING+${FINI_END}} |
288 | } =${NOP-0} | |
289 | ${RELOCATING+PROVIDE (__etext = .);} | |
290 | ${RELOCATING+PROVIDE (_etext = .);} | |
291 | ${RELOCATING+PROVIDE (etext = .);} | |
292 | ${WRITABLE_RODATA-${RODATA}} | |
293 | .rodata1 ${RELOCATING-0} : { *(.rodata1) } | |
294 | ${CREATE_SHLIB-${SDATA2}} | |
295 | ${CREATE_SHLIB-${SBSS2}} | |
296 | ${OTHER_READONLY_SECTIONS} | |
c2e86386 | 297 | .eh_frame_hdr ${RELOCATING-0} : { *(.eh_frame_hdr) } |
2bf2bf23 | 298 | .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } |
886a2506 NC |
299 | |
300 | /* Adjust the address for the data segment. We want to adjust up to | |
301 | the same address within the page on the next page up. */ | |
302 | ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}} | |
303 | ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} | |
304 | ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} | |
305 | ||
306 | /* Exception handling */ | |
2bf2bf23 | 307 | .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } |
886a2506 NC |
308 | |
309 | /* Ensure the __preinit_array_start label is properly aligned. We | |
310 | could instead move the label definition inside the section, but | |
311 | the linker would then create the section even if it turns out to | |
312 | be empty, which isn't pretty. */ | |
313 | ${RELOCATING+. = ALIGN(${ALIGNMENT});} | |
314 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}} | |
315 | .preinit_array ${RELOCATING-0} : { *(.preinit_array) } | |
316 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}} | |
317 | ||
318 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}} | |
319 | .init_array ${RELOCATING-0} : { *(.init_array) } | |
320 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}} | |
321 | ||
322 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}} | |
323 | .fini_array ${RELOCATING-0} : { *(.fini_array) } | |
324 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}} | |
325 | ||
326 | .data ${RELOCATING-0} : | |
327 | { | |
328 | ${RELOCATING+${DATA_START_SYMBOLS}} | |
329 | *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*}) | |
330 | ${CONSTRUCTING+SORT(CONSTRUCTORS)} | |
331 | } | |
332 | .data.init ${RELOCATING-0} : | |
333 | { | |
334 | *(.data.init) | |
335 | } | |
336 | .data1 ${RELOCATING-0} : { *(.data1) } | |
337 | .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } | |
338 | .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } | |
339 | .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } | |
340 | .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } | |
341 | ${WRITABLE_RODATA+${RODATA}} | |
342 | ${OTHER_READWRITE_SECTIONS} | |
343 | ${TEXT_DYNAMIC-${DYNAMIC}} | |
344 | ${RELOCATING+${CTOR}} | |
345 | ${RELOCATING+${DTOR}} | |
346 | .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } | |
347 | ${DATA_PLT+${PLT}} | |
348 | ${RELOCATING+${OTHER_GOT_SYMBOLS}} | |
349 | ${GOT} | |
350 | ${OTHER_GOT_SECTIONS} | |
351 | ${CREATE_SHLIB+${SDATA2}} | |
352 | ${CREATE_SHLIB+${SBSS2}} | |
353 | ${SDATA} | |
354 | ${OTHER_SDATA_SECTIONS} | |
355 | ${RELOCATING+_edata = .;} | |
356 | ${RELOCATING+PROVIDE (edata = .);} | |
357 | ${RELOCATING+__bss_start = .;} | |
358 | ${RELOCATING+${OTHER_BSS_SYMBOLS}} | |
359 | ${SBSS} | |
360 | ${BSS_PLT+${PLT}} | |
361 | .bss ${RELOCATING-0} : | |
362 | { | |
2bf2bf23 AM |
363 | ${RELOCATING+*(.dynbss)} |
364 | *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*}) | |
365 | ${RELOCATING+*(COMMON) | |
366 | /* Align here to ensure that the .bss section occupies space up to | |
367 | _end. Align after .bss to ensure correct alignment even if the | |
368 | .bss section disappears because there are no input sections. */ | |
369 | . = ALIGN(${ALIGNMENT});} | |
886a2506 NC |
370 | } |
371 | ${OTHER_BSS_SECTIONS} | |
372 | ${RELOCATING+. = ALIGN(${ALIGNMENT});} | |
373 | ${RELOCATING+_end = .;} | |
374 | ${RELOCATING+${OTHER_BSS_END_SYMBOLS}} | |
375 | ${RELOCATING+PROVIDE (end = .);} | |
376 | ${RELOCATING+${DATA_SEGMENT_END}} | |
2bf2bf23 | 377 | EOF |
886a2506 | 378 | |
2bf2bf23 | 379 | test -n "${RELOCATING}" && cat <<EOF |
886a2506 NC |
380 | /* We want to be able to set a default stack / heap size in a dejagnu |
381 | board description file, but override it for selected test cases. | |
382 | The options appear in the wrong order to do this with a single symbol - | |
383 | ldflags comes after flags injected with per-file stanzas, and thus | |
384 | the setting from ldflags prevails. */ | |
2bf2bf23 | 385 | .heap : |
886a2506 | 386 | { |
2bf2bf23 AM |
387 | __start_heap = . ; |
388 | . = . + (DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : (DEFINED(__DEFAULT_HEAP_SIZE) ? __DEFAULT_HEAP_SIZE : 20k)) ; | |
389 | __end_heap = . ; | |
886a2506 NC |
390 | } |
391 | ||
2bf2bf23 AM |
392 | . = ALIGN(0x8); |
393 | .stack : | |
886a2506 | 394 | { |
2bf2bf23 AM |
395 | __stack = . ; |
396 | . = . + (DEFINED(__STACK_SIZE) ? __STACK_SIZE : (DEFINED(__DEFAULT_STACK_SIZE) ? __DEFAULT_STACK_SIZE : 64k)) ; | |
397 | __stack_top = . ; | |
886a2506 | 398 | } |
2bf2bf23 | 399 | EOF |
886a2506 | 400 | |
2bf2bf23 | 401 | cat <<EOF |
886a2506 NC |
402 | /* Stabs debugging sections. */ |
403 | .stab 0 : { *(.stab) } | |
404 | .stabstr 0 : { *(.stabstr) } | |
405 | .stab.excl 0 : { *(.stab.excl) } | |
406 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
407 | .stab.index 0 : { *(.stab.index) } | |
408 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
409 | ||
410 | .comment 0 : { *(.comment) } | |
411 | ||
412 | /* DWARF debug sections. | |
413 | Symbols in the DWARF debugging sections are relative to the beginning | |
414 | of the section so we begin them at 0. */ | |
415 | ||
416 | /* DWARF 1 */ | |
417 | .debug 0 : { *(.debug) } | |
418 | .line 0 : { *(.line) } | |
419 | ||
420 | /* GNU DWARF 1 extensions */ | |
421 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | |
422 | .debug_sfnames 0 : { *(.debug_sfnames) } | |
423 | ||
424 | /* DWARF 1.1 and DWARF 2 */ | |
425 | .debug_aranges 0 : { *(.debug_aranges) } | |
426 | .debug_pubnames 0 : { *(.debug_pubnames) } | |
427 | ||
428 | /* DWARF 2 */ | |
2bf2bf23 | 429 | .debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*}) } |
886a2506 NC |
430 | .debug_abbrev 0 : { *(.debug_abbrev) } |
431 | .debug_line 0 : { *(.debug_line) } | |
432 | .debug_frame 0 : { *(.debug_frame) } | |
433 | .debug_str 0 : { *(.debug_str) } | |
434 | .debug_loc 0 : { *(.debug_loc) } | |
435 | .debug_macinfo 0 : { *(.debug_macinfo) } | |
436 | ||
437 | /* SGI/MIPS DWARF 2 extensions */ | |
438 | .debug_weaknames 0 : { *(.debug_weaknames) } | |
439 | .debug_funcnames 0 : { *(.debug_funcnames) } | |
440 | .debug_typenames 0 : { *(.debug_typenames) } | |
441 | .debug_varnames 0 : { *(.debug_varnames) } | |
442 | ||
443 | /* ARC Extension Sections */ | |
444 | .arcextmap 0 : { *(.gnu.linkonce.arcextmap.*) } | |
445 | ||
886a2506 NC |
446 | ${OTHER_SECTIONS} |
447 | ${RELOCATING+${OTHER_END_SYMBOLS}} | |
448 | ${RELOCATING+${STACKNOTE}} | |
449 | } | |
450 | EOF |