]>
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 | |
5fd82aa2 | 72 | test "${ARC_ENDIAN}" = "big" && OUTPUT_FORMAT=${BIG_OUTPUT_FORMAT} |
886a2506 NC |
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 | |
223d5266 SV |
121 | INIT_ARRAY=".init_array ${RELOCATING-0} : |
122 | { | |
123 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}} | |
124 | KEEP (*(SORT(.init_array.*))) | |
125 | KEEP (*(.init_array)) | |
126 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}} | |
127 | }" | |
128 | FINI_ARRAY=".fini_array ${RELOCATING-0} : | |
129 | { | |
130 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}} | |
131 | KEEP (*(SORT(.fini_array.*))) | |
132 | KEEP (*(.fini_array)) | |
133 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}} | |
134 | }" | |
6c19b93b | 135 | CTOR=".ctors ${CONSTRUCTING-0} : |
886a2506 NC |
136 | { |
137 | ${CONSTRUCTING+${CTOR_START}} | |
138 | /* gcc uses crtbegin.o to find the start of | |
139 | the constructors, so we make sure it is | |
140 | first. Because this is a wildcard, it | |
141 | doesn't matter if the user does not | |
142 | actually link against crtbegin.o; the | |
143 | linker won't look for a file to match a | |
144 | wildcard. The wildcard also means that it | |
145 | doesn't matter which directory crtbegin.o | |
146 | is in. */ | |
147 | ||
148 | KEEP (*crtbegin*.o(.ctors)) | |
149 | ||
150 | /* We don't want to include the .ctor section from | |
151 | from the crtend.o file until after the sorted ctors. | |
152 | The .ctor section from the crtend file contains the | |
153 | end of ctors marker and it must be last */ | |
154 | ||
155 | KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) | |
156 | KEEP (*(SORT(.ctors.*))) | |
157 | KEEP (*(.ctors)) | |
158 | ${CONSTRUCTING+${CTOR_END}} | |
159 | }" | |
160 | DTOR=".dtors ${CONSTRUCTING-0} : | |
161 | { | |
162 | ${CONSTRUCTING+${DTOR_START}} | |
163 | KEEP (*crtbegin*.o(.dtors)) | |
164 | KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) | |
165 | KEEP (*(SORT(.dtors.*))) | |
166 | KEEP (*(.dtors)) | |
167 | ${CONSTRUCTING+${DTOR_END}} | |
168 | }" | |
169 | STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : | |
170 | { | |
171 | ${RELOCATING+_stack = .;} | |
172 | *(.stack) | |
173 | }" | |
174 | ||
3ed3c104 L |
175 | TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})" |
176 | SHLIB_TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${SHLIB_TEXT_START_ADDR:-0})" | |
177 | ||
886a2506 NC |
178 | # if this is for an embedded system, don't add SIZEOF_HEADERS. |
179 | if [ -z "$EMBEDDED" ]; then | |
180 | test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS" | |
181 | else | |
182 | test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}" | |
183 | fi | |
184 | ||
185 | cat <<EOF | |
186 | OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", | |
187 | "${LITTLE_OUTPUT_FORMAT}") | |
188 | OUTPUT_ARCH(${OUTPUT_ARCH}) | |
189 | ${RELOCATING+ENTRY(${ENTRY})} | |
190 | ||
191 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
192 | ${RELOCATING+/* Do we need any of these for elf? | |
193 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} | |
194 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} | |
195 | ${RELOCATING+${INPUT_FILES}} | |
196 | ${RELOCATING- /* For some reason, the Solaris linker makes bad executables | |
197 | if gld -r is used and the intermediate file has sections starting | |
198 | at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld | |
199 | bug. But for now assigning the zero vmas works. */} | |
200 | ||
201 | SECTIONS | |
202 | { | |
203 | /* Read-only sections, merged into text segment: */ | |
204 | ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}} | |
205 | ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} | |
206 | ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} | |
207 | ${CREATE_SHLIB-${INTERP}} | |
208 | ${INITIAL_READONLY_SECTIONS} | |
209 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
210 | .hash ${RELOCATING-0} : { *(.hash) } | |
211 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
212 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
213 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
214 | .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) } | |
215 | .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) } | |
216 | ||
217 | EOF | |
218 | if [ "x$COMBRELOC" = x ]; then | |
219 | COMBRELOCCAT=cat | |
220 | else | |
221 | COMBRELOCCAT="cat > $COMBRELOC" | |
222 | fi | |
223 | eval $COMBRELOCCAT <<EOF | |
224 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
225 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
226 | .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) } | |
227 | .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) } | |
228 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } | |
229 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
230 | .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) } | |
231 | .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) } | |
232 | ${OTHER_READONLY_RELOC_SECTIONS} | |
233 | .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) } | |
234 | .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) } | |
235 | .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) } | |
236 | .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) } | |
237 | .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) } | |
238 | .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) } | |
239 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } | |
240 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
241 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
242 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
243 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
244 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
245 | ${OTHER_GOT_RELOC_SECTIONS} | |
246 | ${REL_SDATA} | |
247 | ${REL_SBSS} | |
248 | ${REL_SDATA2} | |
249 | ${REL_SBSS2} | |
250 | .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) } | |
251 | .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) } | |
252 | EOF | |
253 | if [ -n "$COMBRELOC" ]; then | |
254 | cat <<EOF | |
255 | .rel.dyn ${RELOCATING-0} : | |
256 | { | |
257 | EOF | |
6c19b93b | 258 | sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC |
886a2506 NC |
259 | cat <<EOF |
260 | } | |
261 | .rela.dyn ${RELOCATING-0} : | |
262 | { | |
263 | EOF | |
6c19b93b | 264 | sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC |
886a2506 NC |
265 | cat <<EOF |
266 | } | |
267 | EOF | |
268 | fi | |
269 | cat <<EOF | |
270 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
271 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
272 | ${OTHER_PLT_RELOC_SECTIONS} | |
273 | ||
6c19b93b AM |
274 | .init ${RELOCATING-0} : |
275 | { | |
886a2506 | 276 | ${RELOCATING+${INIT_START}} |
2d3181c7 | 277 | KEEP (*(SORT_NONE(.init))) |
886a2506 NC |
278 | ${RELOCATING+${INIT_END}} |
279 | } =${NOP-0} | |
280 | ||
281 | ${DATA_PLT-${BSS_PLT-${PLT}}} | |
684d5a10 JEM |
282 | .jlitab ${RELOCATING-0} : |
283 | { | |
284 | ${RELOCATING+${JLI_START_TABLE}} | |
2bf2bf23 AM |
285 | ${RELOCATING+jlitab*.o(.jlitab*)} |
286 | *(.jlitab${RELOCATING+*}) | |
684d5a10 | 287 | } =${NOP-0} |
886a2506 NC |
288 | .text ${RELOCATING-0} : |
289 | { | |
290 | ${RELOCATING+${TEXT_START_SYMBOLS}} | |
291 | *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*}) | |
075a2b89 | 292 | /* .gnu.warning sections are handled specially by elf.em. */ |
886a2506 NC |
293 | *(.gnu.warning) |
294 | ${RELOCATING+${OTHER_TEXT_SECTIONS}} | |
295 | } =${NOP-0} | |
296 | .text.init ${RELOCATING-0} : | |
297 | { | |
298 | *(.text.init) | |
299 | } =${NOP-0} | |
300 | .fini ${RELOCATING-0} : | |
301 | { | |
302 | ${RELOCATING+${FINI_START}} | |
2d3181c7 | 303 | KEEP (*(SORT_NONE(.fini))) |
886a2506 NC |
304 | ${RELOCATING+${FINI_END}} |
305 | } =${NOP-0} | |
306 | ${RELOCATING+PROVIDE (__etext = .);} | |
307 | ${RELOCATING+PROVIDE (_etext = .);} | |
308 | ${RELOCATING+PROVIDE (etext = .);} | |
309 | ${WRITABLE_RODATA-${RODATA}} | |
310 | .rodata1 ${RELOCATING-0} : { *(.rodata1) } | |
311 | ${CREATE_SHLIB-${SDATA2}} | |
312 | ${CREATE_SHLIB-${SBSS2}} | |
313 | ${OTHER_READONLY_SECTIONS} | |
c2e86386 | 314 | .eh_frame_hdr ${RELOCATING-0} : { *(.eh_frame_hdr) } |
2bf2bf23 | 315 | .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } |
886a2506 NC |
316 | |
317 | /* Adjust the address for the data segment. We want to adjust up to | |
318 | the same address within the page on the next page up. */ | |
319 | ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}} | |
320 | ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} | |
321 | ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} | |
322 | ||
323 | /* Exception handling */ | |
2bf2bf23 | 324 | .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } |
886a2506 NC |
325 | |
326 | /* Ensure the __preinit_array_start label is properly aligned. We | |
327 | could instead move the label definition inside the section, but | |
328 | the linker would then create the section even if it turns out to | |
329 | be empty, which isn't pretty. */ | |
330 | ${RELOCATING+. = ALIGN(${ALIGNMENT});} | |
331 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}} | |
332 | .preinit_array ${RELOCATING-0} : { *(.preinit_array) } | |
333 | ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}} | |
223d5266 SV |
334 | ${RELOCATING+${INIT_ARRAY}} |
335 | ${RELOCATING+${FINI_ARRAY}} | |
886a2506 NC |
336 | |
337 | .data ${RELOCATING-0} : | |
338 | { | |
339 | ${RELOCATING+${DATA_START_SYMBOLS}} | |
340 | *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*}) | |
341 | ${CONSTRUCTING+SORT(CONSTRUCTORS)} | |
342 | } | |
343 | .data.init ${RELOCATING-0} : | |
344 | { | |
345 | *(.data.init) | |
346 | } | |
347 | .data1 ${RELOCATING-0} : { *(.data1) } | |
348 | .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } | |
349 | .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } | |
350 | .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } | |
351 | .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } | |
352 | ${WRITABLE_RODATA+${RODATA}} | |
353 | ${OTHER_READWRITE_SECTIONS} | |
354 | ${TEXT_DYNAMIC-${DYNAMIC}} | |
355 | ${RELOCATING+${CTOR}} | |
356 | ${RELOCATING+${DTOR}} | |
357 | .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } | |
358 | ${DATA_PLT+${PLT}} | |
359 | ${RELOCATING+${OTHER_GOT_SYMBOLS}} | |
360 | ${GOT} | |
361 | ${OTHER_GOT_SECTIONS} | |
362 | ${CREATE_SHLIB+${SDATA2}} | |
363 | ${CREATE_SHLIB+${SBSS2}} | |
364 | ${SDATA} | |
365 | ${OTHER_SDATA_SECTIONS} | |
366 | ${RELOCATING+_edata = .;} | |
367 | ${RELOCATING+PROVIDE (edata = .);} | |
368 | ${RELOCATING+__bss_start = .;} | |
369 | ${RELOCATING+${OTHER_BSS_SYMBOLS}} | |
370 | ${SBSS} | |
371 | ${BSS_PLT+${PLT}} | |
372 | .bss ${RELOCATING-0} : | |
373 | { | |
2bf2bf23 AM |
374 | ${RELOCATING+*(.dynbss)} |
375 | *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*}) | |
376 | ${RELOCATING+*(COMMON) | |
377 | /* Align here to ensure that the .bss section occupies space up to | |
378 | _end. Align after .bss to ensure correct alignment even if the | |
379 | .bss section disappears because there are no input sections. */ | |
380 | . = ALIGN(${ALIGNMENT});} | |
886a2506 NC |
381 | } |
382 | ${OTHER_BSS_SECTIONS} | |
383 | ${RELOCATING+. = ALIGN(${ALIGNMENT});} | |
384 | ${RELOCATING+_end = .;} | |
385 | ${RELOCATING+${OTHER_BSS_END_SYMBOLS}} | |
386 | ${RELOCATING+PROVIDE (end = .);} | |
387 | ${RELOCATING+${DATA_SEGMENT_END}} | |
2bf2bf23 | 388 | EOF |
886a2506 | 389 | |
2bf2bf23 | 390 | test -n "${RELOCATING}" && cat <<EOF |
886a2506 NC |
391 | /* We want to be able to set a default stack / heap size in a dejagnu |
392 | board description file, but override it for selected test cases. | |
393 | The options appear in the wrong order to do this with a single symbol - | |
394 | ldflags comes after flags injected with per-file stanzas, and thus | |
395 | the setting from ldflags prevails. */ | |
2bf2bf23 | 396 | .heap : |
886a2506 | 397 | { |
2bf2bf23 AM |
398 | __start_heap = . ; |
399 | . = . + (DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : (DEFINED(__DEFAULT_HEAP_SIZE) ? __DEFAULT_HEAP_SIZE : 20k)) ; | |
400 | __end_heap = . ; | |
886a2506 NC |
401 | } |
402 | ||
2bf2bf23 AM |
403 | . = ALIGN(0x8); |
404 | .stack : | |
886a2506 | 405 | { |
2bf2bf23 AM |
406 | __stack = . ; |
407 | . = . + (DEFINED(__STACK_SIZE) ? __STACK_SIZE : (DEFINED(__DEFAULT_STACK_SIZE) ? __DEFAULT_STACK_SIZE : 64k)) ; | |
408 | __stack_top = . ; | |
886a2506 | 409 | } |
2bf2bf23 | 410 | EOF |
886a2506 | 411 | |
2bf2bf23 | 412 | cat <<EOF |
886a2506 NC |
413 | /* Stabs debugging sections. */ |
414 | .stab 0 : { *(.stab) } | |
415 | .stabstr 0 : { *(.stabstr) } | |
416 | .stab.excl 0 : { *(.stab.excl) } | |
417 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
418 | .stab.index 0 : { *(.stab.index) } | |
419 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
420 | ||
421 | .comment 0 : { *(.comment) } | |
8cb31bad CZ |
422 | .note.gnu.build-id : { *(.note.gnu.build-id) } |
423 | EOF | |
886a2506 | 424 | |
8cb31bad | 425 | . $srcdir/scripttempl/DWARF.sc |
886a2506 | 426 | |
8cb31bad | 427 | cat <<EOF |
886a2506 | 428 | /* ARC Extension Sections */ |
8cb31bad | 429 | .arcextmap 0 : { *(.arcextmap.*) } |
886a2506 | 430 | |
886a2506 NC |
431 | ${OTHER_SECTIONS} |
432 | ${RELOCATING+${OTHER_END_SYMBOLS}} | |
433 | ${RELOCATING+${STACKNOTE}} | |
434 | } | |
435 | EOF |