epiphany_4x4.sc revision 1.1.1.1.2.2 1 1.1.1.1.2.2 pgoyette # Copyright (C) 2014-2015 Free Software Foundation, Inc.
2 1.1.1.1.2.2 pgoyette #
3 1.1.1.1.2.2 pgoyette # Copying and distribution of this file, with or without modification,
4 1.1.1.1.2.2 pgoyette # are permitted in any medium without royalty provided the copyright
5 1.1.1.1.2.2 pgoyette # notice and this notice are preserved.
6 1.1.1.1.2.2 pgoyette #
7 1.1.1.1.2.2 pgoyette # Unusual variables checked by this code:
8 1.1.1.1.2.2 pgoyette # NOP - four byte opcode for no-op (defaults to 0)
9 1.1.1.1.2.2 pgoyette # NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
10 1.1.1.1.2.2 pgoyette # empty.
11 1.1.1.1.2.2 pgoyette # SMALL_DATA_CTOR - .ctors contains small data.
12 1.1.1.1.2.2 pgoyette # SMALL_DATA_DTOR - .dtors contains small data.
13 1.1.1.1.2.2 pgoyette # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
14 1.1.1.1.2.2 pgoyette # INITIAL_READONLY_SECTIONS - at start of text segment
15 1.1.1.1.2.2 pgoyette # OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
16 1.1.1.1.2.2 pgoyette # (e.g., .PARISC.milli)
17 1.1.1.1.2.2 pgoyette # OTHER_TEXT_SECTIONS - these get put in .text when relocating
18 1.1.1.1.2.2 pgoyette # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
19 1.1.1.1.2.2 pgoyette # (e.g., .PARISC.global)
20 1.1.1.1.2.2 pgoyette # OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
21 1.1.1.1.2.2 pgoyette # (e.g. PPC32 .fixup, .got[12])
22 1.1.1.1.2.2 pgoyette # OTHER_BSS_SECTIONS - other than .bss .sbss ...
23 1.1.1.1.2.2 pgoyette # ATTRS_SECTIONS - at the end
24 1.1.1.1.2.2 pgoyette # OTHER_SECTIONS - at the end
25 1.1.1.1.2.2 pgoyette # EXECUTABLE_SYMBOLS - symbols that must be defined for an
26 1.1.1.1.2.2 pgoyette # executable (e.g., _DYNAMIC_LINK)
27 1.1.1.1.2.2 pgoyette # TEXT_START_ADDR - the first byte of the text segment, after any
28 1.1.1.1.2.2 pgoyette # headers.
29 1.1.1.1.2.2 pgoyette # TEXT_BASE_ADDRESS - the first byte of the text segment.
30 1.1.1.1.2.2 pgoyette # TEXT_START_SYMBOLS - symbols that appear at the start of the
31 1.1.1.1.2.2 pgoyette # .text section.
32 1.1.1.1.2.2 pgoyette # DATA_START_SYMBOLS - symbols that appear at the start of the
33 1.1.1.1.2.2 pgoyette # .data section.
34 1.1.1.1.2.2 pgoyette # DATA_END_SYMBOLS - symbols that appear at the end of the
35 1.1.1.1.2.2 pgoyette # writeable data sections.
36 1.1.1.1.2.2 pgoyette # OTHER_GOT_SYMBOLS - symbols defined just before .got.
37 1.1.1.1.2.2 pgoyette # OTHER_GOT_SECTIONS - sections just after .got.
38 1.1.1.1.2.2 pgoyette # OTHER_SDATA_SECTIONS - sections just after .sdata.
39 1.1.1.1.2.2 pgoyette # OTHER_BSS_SYMBOLS - symbols that appear at the start of the
40 1.1.1.1.2.2 pgoyette # .bss section besides ___bss_start.
41 1.1.1.1.2.2 pgoyette # DATA_PLT - .plt should be in data segment, not text segment.
42 1.1.1.1.2.2 pgoyette # PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
43 1.1.1.1.2.2 pgoyette # BSS_PLT - .plt should be in bss segment
44 1.1.1.1.2.2 pgoyette # NO_REL_RELOCS - Don't include .rel.* sections in script
45 1.1.1.1.2.2 pgoyette # NO_RELA_RELOCS - Don't include .rela.* sections in script
46 1.1.1.1.2.2 pgoyette # NON_ALLOC_DYN - Place dynamic sections after data segment.
47 1.1.1.1.2.2 pgoyette # TEXT_DYNAMIC - .dynamic in text segment, not data segment.
48 1.1.1.1.2.2 pgoyette # EMBEDDED - whether this is for an embedded system.
49 1.1.1.1.2.2 pgoyette # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
50 1.1.1.1.2.2 pgoyette # start address of shared library.
51 1.1.1.1.2.2 pgoyette # INPUT_FILES - INPUT command of files to always include
52 1.1.1.1.2.2 pgoyette # WRITABLE_RODATA - if set, the .rodata section should be writable
53 1.1.1.1.2.2 pgoyette # INIT_START, INIT_END - statements just before and just after
54 1.1.1.1.2.2 pgoyette # combination of .init sections.
55 1.1.1.1.2.2 pgoyette # FINI_START, FINI_END - statements just before and just after
56 1.1.1.1.2.2 pgoyette # combination of .fini sections.
57 1.1.1.1.2.2 pgoyette # STACK_ADDR - start of a .stack section.
58 1.1.1.1.2.2 pgoyette # OTHER_SYMBOLS - symbols to place right at the end of the script.
59 1.1.1.1.2.2 pgoyette # ETEXT_NAME - name of a symbol for the end of the text section,
60 1.1.1.1.2.2 pgoyette # normally etext.
61 1.1.1.1.2.2 pgoyette # SEPARATE_GOTPLT - if set, .got.plt should be separate output section,
62 1.1.1.1.2.2 pgoyette # so that .got can be in the RELRO area. It should be set to
63 1.1.1.1.2.2 pgoyette # the number of bytes in the beginning of .got.plt which can be
64 1.1.1.1.2.2 pgoyette # in the RELRO area as well.
65 1.1.1.1.2.2 pgoyette # USER_LABEL_PREFIX - prefix to add to user-visible symbols.
66 1.1.1.1.2.2 pgoyette #
67 1.1.1.1.2.2 pgoyette # When adding sections, do note that the names of some sections are used
68 1.1.1.1.2.2 pgoyette # when specifying the start address of the next.
69 1.1.1.1.2.2 pgoyette #
70 1.1.1.1.2.2 pgoyette
71 1.1.1.1.2.2 pgoyette # Many sections come in three flavours. There is the 'real' section,
72 1.1.1.1.2.2 pgoyette # like ".data". Then there are the per-procedure or per-variable
73 1.1.1.1.2.2 pgoyette # sections, generated by -ffunction-sections and -fdata-sections in GCC,
74 1.1.1.1.2.2 pgoyette # and useful for --gc-sections, which for a variable "foo" might be
75 1.1.1.1.2.2 pgoyette # ".data.foo". Then there are the linkonce sections, for which the linker
76 1.1.1.1.2.2 pgoyette # eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
77 1.1.1.1.2.2 pgoyette # The exact correspondences are:
78 1.1.1.1.2.2 pgoyette #
79 1.1.1.1.2.2 pgoyette # Section Linkonce section
80 1.1.1.1.2.2 pgoyette # .text .gnu.linkonce.t.foo
81 1.1.1.1.2.2 pgoyette # .rodata .gnu.linkonce.r.foo
82 1.1.1.1.2.2 pgoyette # .data .gnu.linkonce.d.foo
83 1.1.1.1.2.2 pgoyette # .bss .gnu.linkonce.b.foo
84 1.1.1.1.2.2 pgoyette # .sdata .gnu.linkonce.s.foo
85 1.1.1.1.2.2 pgoyette # .sbss .gnu.linkonce.sb.foo
86 1.1.1.1.2.2 pgoyette # .sdata2 .gnu.linkonce.s2.foo
87 1.1.1.1.2.2 pgoyette # .sbss2 .gnu.linkonce.sb2.foo
88 1.1.1.1.2.2 pgoyette # .debug_info .gnu.linkonce.wi.foo
89 1.1.1.1.2.2 pgoyette # .tdata .gnu.linkonce.td.foo
90 1.1.1.1.2.2 pgoyette # .tbss .gnu.linkonce.tb.foo
91 1.1.1.1.2.2 pgoyette # .lrodata .gnu.linkonce.lr.foo
92 1.1.1.1.2.2 pgoyette # .ldata .gnu.linkonce.l.foo
93 1.1.1.1.2.2 pgoyette # .lbss .gnu.linkonce.lb.foo
94 1.1.1.1.2.2 pgoyette #
95 1.1.1.1.2.2 pgoyette # Each of these can also have corresponding .rel.* and .rela.* sections.
96 1.1.1.1.2.2 pgoyette
97 1.1.1.1.2.2 pgoyette
98 1.1.1.1.2.2 pgoyette test -z "$ENTRY" && ENTRY=_start
99 1.1.1.1.2.2 pgoyette test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
100 1.1.1.1.2.2 pgoyette test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
101 1.1.1.1.2.2 pgoyette if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
102 1.1.1.1.2.2 pgoyette test -z "${ELFSIZE}" && ELFSIZE=32
103 1.1.1.1.2.2 pgoyette test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
104 1.1.1.1.2.2 pgoyette test "$LD_FLAG" = "N" && DATA_ADDR=.
105 1.1.1.1.2.2 pgoyette test -z "${ETEXT_NAME}" && ETEXT_NAME=etext
106 1.1.1.1.2.2 pgoyette test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
107 1.1.1.1.2.2 pgoyette test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
108 1.1.1.1.2.2 pgoyette test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
109 1.1.1.1.2.2 pgoyette test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
110 1.1.1.1.2.2 pgoyette DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
111 1.1.1.1.2.2 pgoyette DATA_SEGMENT_RELRO_END=""
112 1.1.1.1.2.2 pgoyette DATA_SEGMENT_END=""
113 1.1.1.1.2.2 pgoyette if test -n "${COMMONPAGESIZE}"; then
114 1.1.1.1.2.2 pgoyette DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
115 1.1.1.1.2.2 pgoyette DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
116 1.1.1.1.2.2 pgoyette DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
117 1.1.1.1.2.2 pgoyette fi
118 1.1.1.1.2.2 pgoyette if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
119 1.1.1.1.2.2 pgoyette INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
120 1.1.1.1.2.2 pgoyette fi
121 1.1.1.1.2.2 pgoyette if test -z "$PLT"; then
122 1.1.1.1.2.2 pgoyette PLT=".plt ${RELOCATING-0} : { *(.plt) }"
123 1.1.1.1.2.2 pgoyette fi
124 1.1.1.1.2.2 pgoyette test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes
125 1.1.1.1.2.2 pgoyette if test -z "$GOT"; then
126 1.1.1.1.2.2 pgoyette if test -z "$SEPARATE_GOTPLT"; then
127 1.1.1.1.2.2 pgoyette GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }"
128 1.1.1.1.2.2 pgoyette else
129 1.1.1.1.2.2 pgoyette GOT=".got ${RELOCATING-0} : { *(.got) }"
130 1.1.1.1.2.2 pgoyette GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }"
131 1.1.1.1.2.2 pgoyette fi
132 1.1.1.1.2.2 pgoyette fi
133 1.1.1.1.2.2 pgoyette DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
134 1.1.1.1.2.2 pgoyette RODATA=".rodata ${RELOCATING+ADDR(.data)+SIZEOF(.data)} ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) } /*> INTERNAL_RAM*/"
135 1.1.1.1.2.2 pgoyette DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }"
136 1.1.1.1.2.2 pgoyette DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }"
137 1.1.1.1.2.2 pgoyette if test -z "${NO_SMALL_DATA}"; then
138 1.1.1.1.2.2 pgoyette SBSS=".sbss ${RELOCATING-0} :
139 1.1.1.1.2.2 pgoyette {
140 1.1.1.1.2.2 pgoyette ${RELOCATING+${SBSS_START_SYMBOLS}}
141 1.1.1.1.2.2 pgoyette ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)}
142 1.1.1.1.2.2 pgoyette *(.dynsbss)
143 1.1.1.1.2.2 pgoyette *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*})
144 1.1.1.1.2.2 pgoyette *(.scommon)
145 1.1.1.1.2.2 pgoyette ${RELOCATING+${SBSS_END_SYMBOLS}}
146 1.1.1.1.2.2 pgoyette }"
147 1.1.1.1.2.2 pgoyette SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }"
148 1.1.1.1.2.2 pgoyette SDATA="/* We want the small data sections together, so single-instruction offsets
149 1.1.1.1.2.2 pgoyette can access them all, and initialized data all before uninitialized, so
150 1.1.1.1.2.2 pgoyette we can shorten the on-disk segment size. */
151 1.1.1.1.2.2 pgoyette .sdata ${RELOCATING-0} :
152 1.1.1.1.2.2 pgoyette {
153 1.1.1.1.2.2 pgoyette ${RELOCATING+${SDATA_START_SYMBOLS}}
154 1.1.1.1.2.2 pgoyette ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}
155 1.1.1.1.2.2 pgoyette *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*})
156 1.1.1.1.2.2 pgoyette }"
157 1.1.1.1.2.2 pgoyette SDATA2=".sdata2 ${RELOCATING-0} :
158 1.1.1.1.2.2 pgoyette {
159 1.1.1.1.2.2 pgoyette ${RELOCATING+${SDATA2_START_SYMBOLS}}
160 1.1.1.1.2.2 pgoyette *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*})
161 1.1.1.1.2.2 pgoyette }"
162 1.1.1.1.2.2 pgoyette REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) }
163 1.1.1.1.2.2 pgoyette .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }"
164 1.1.1.1.2.2 pgoyette REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) }
165 1.1.1.1.2.2 pgoyette .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }"
166 1.1.1.1.2.2 pgoyette REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) }
167 1.1.1.1.2.2 pgoyette .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }"
168 1.1.1.1.2.2 pgoyette REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) }
169 1.1.1.1.2.2 pgoyette .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }"
170 1.1.1.1.2.2 pgoyette else
171 1.1.1.1.2.2 pgoyette NO_SMALL_DATA=" "
172 1.1.1.1.2.2 pgoyette fi
173 1.1.1.1.2.2 pgoyette if test -z "${DATA_GOT}"; then
174 1.1.1.1.2.2 pgoyette if test -n "${NO_SMALL_DATA}"; then
175 1.1.1.1.2.2 pgoyette DATA_GOT=" "
176 1.1.1.1.2.2 pgoyette fi
177 1.1.1.1.2.2 pgoyette fi
178 1.1.1.1.2.2 pgoyette if test -z "${SDATA_GOT}"; then
179 1.1.1.1.2.2 pgoyette if test -z "${NO_SMALL_DATA}"; then
180 1.1.1.1.2.2 pgoyette SDATA_GOT=" "
181 1.1.1.1.2.2 pgoyette fi
182 1.1.1.1.2.2 pgoyette fi
183 1.1.1.1.2.2 pgoyette test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
184 1.1.1.1.2.2 pgoyette test "${LARGE_SECTIONS}" = "yes" && REL_LARGE="
185 1.1.1.1.2.2 pgoyette .rel.ldata ${RELOCATING-0} : { *(.rel.ldata${RELOCATING+ .rel.ldata.* .rel.gnu.linkonce.l.*}) }
186 1.1.1.1.2.2 pgoyette .rela.ldata ${RELOCATING-0} : { *(.rela.ldata${RELOCATING+ .rela.ldata.* .rela.gnu.linkonce.l.*}) }
187 1.1.1.1.2.2 pgoyette .rel.lbss ${RELOCATING-0} : { *(.rel.lbss${RELOCATING+ .rel.lbss.* .rel.gnu.linkonce.lb.*}) }
188 1.1.1.1.2.2 pgoyette .rela.lbss ${RELOCATING-0} : { *(.rela.lbss${RELOCATING+ .rela.lbss.* .rela.gnu.linkonce.lb.*}) }
189 1.1.1.1.2.2 pgoyette .rel.lrodata ${RELOCATING-0} : { *(.rel.lrodata${RELOCATING+ .rel.lrodata.* .rel.gnu.linkonce.lr.*}) }
190 1.1.1.1.2.2 pgoyette .rela.lrodata ${RELOCATING-0} : { *(.rela.lrodata${RELOCATING+ .rela.lrodata.* .rela.gnu.linkonce.lr.*}) }"
191 1.1.1.1.2.2 pgoyette test "${LARGE_SECTIONS}" = "yes" && OTHER_BSS_SECTIONS="
192 1.1.1.1.2.2 pgoyette ${OTHER_BSS_SECTIONS}
193 1.1.1.1.2.2 pgoyette .lbss ${RELOCATING-0} :
194 1.1.1.1.2.2 pgoyette {
195 1.1.1.1.2.2 pgoyette *(.dynlbss)
196 1.1.1.1.2.2 pgoyette *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
197 1.1.1.1.2.2 pgoyette *(LARGE_COMMON)
198 1.1.1.1.2.2 pgoyette }"
199 1.1.1.1.2.2 pgoyette test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
200 1.1.1.1.2.2 pgoyette .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
201 1.1.1.1.2.2 pgoyette {
202 1.1.1.1.2.2 pgoyette *(.lrodata${RELOCATING+ .lrodata.* .gnu.linkonce.lr.*})
203 1.1.1.1.2.2 pgoyette }
204 1.1.1.1.2.2 pgoyette .ldata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
205 1.1.1.1.2.2 pgoyette {
206 1.1.1.1.2.2 pgoyette *(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
207 1.1.1.1.2.2 pgoyette ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
208 1.1.1.1.2.2 pgoyette }"
209 1.1.1.1.2.2 pgoyette CTOR=".ctors ADDR(.text) + SIZEOF(.text) ${CONSTRUCTING-0} :
210 1.1.1.1.2.2 pgoyette {
211 1.1.1.1.2.2 pgoyette ${CONSTRUCTING+${CTOR_START}}
212 1.1.1.1.2.2 pgoyette /* gcc uses crtbegin.o to find the start of
213 1.1.1.1.2.2 pgoyette the constructors, so we make sure it is
214 1.1.1.1.2.2 pgoyette first. Because this is a wildcard, it
215 1.1.1.1.2.2 pgoyette doesn't matter if the user does not
216 1.1.1.1.2.2 pgoyette actually link against crtbegin.o; the
217 1.1.1.1.2.2 pgoyette linker won't look for a file to match a
218 1.1.1.1.2.2 pgoyette wildcard. The wildcard also means that it
219 1.1.1.1.2.2 pgoyette doesn't matter which directory crtbegin.o
220 1.1.1.1.2.2 pgoyette is in. */
221 1.1.1.1.2.2 pgoyette
222 1.1.1.1.2.2 pgoyette KEEP (*crtbegin.o(.ctors))
223 1.1.1.1.2.2 pgoyette KEEP (*crtbegin?.o(.ctors))
224 1.1.1.1.2.2 pgoyette
225 1.1.1.1.2.2 pgoyette /* We don't want to include the .ctor section from
226 1.1.1.1.2.2 pgoyette the crtend.o file until after the sorted ctors.
227 1.1.1.1.2.2 pgoyette The .ctor section from the crtend file contains the
228 1.1.1.1.2.2 pgoyette end of ctors marker and it must be last */
229 1.1.1.1.2.2 pgoyette
230 1.1.1.1.2.2 pgoyette KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
231 1.1.1.1.2.2 pgoyette KEEP (*(SORT(.ctors.*)))
232 1.1.1.1.2.2 pgoyette KEEP (*(.ctors))
233 1.1.1.1.2.2 pgoyette ${CONSTRUCTING+${CTOR_END}}
234 1.1.1.1.2.2 pgoyette } /*> INTERNAL_RAM*/"
235 1.1.1.1.2.2 pgoyette DTOR=".dtors ADDR(.ctors) + SIZEOF(.ctors) ${CONSTRUCTING-0} :
236 1.1.1.1.2.2 pgoyette {
237 1.1.1.1.2.2 pgoyette ${CONSTRUCTING+${DTOR_START}}
238 1.1.1.1.2.2 pgoyette KEEP (*crtbegin.o(.dtors))
239 1.1.1.1.2.2 pgoyette KEEP (*crtbegin?.o(.dtors))
240 1.1.1.1.2.2 pgoyette KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
241 1.1.1.1.2.2 pgoyette KEEP (*(SORT(.dtors.*)))
242 1.1.1.1.2.2 pgoyette KEEP (*(.dtors))
243 1.1.1.1.2.2 pgoyette ${CONSTRUCTING+${DTOR_END}}
244 1.1.1.1.2.2 pgoyette } /*> INTERNAL_RAM*/ "
245 1.1.1.1.2.2 pgoyette STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
246 1.1.1.1.2.2 pgoyette {
247 1.1.1.1.2.2 pgoyette ${RELOCATING+___stack = .;}
248 1.1.1.1.2.2 pgoyette *(.stack)
249 1.1.1.1.2.2 pgoyette }"
250 1.1.1.1.2.2 pgoyette
251 1.1.1.1.2.2 pgoyette # If this is for an embedded system, don't add SIZEOF_HEADERS.
252 1.1.1.1.2.2 pgoyette if [ -z "$EMBEDDED" ]; then
253 1.1.1.1.2.2 pgoyette test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
254 1.1.1.1.2.2 pgoyette else
255 1.1.1.1.2.2 pgoyette test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
256 1.1.1.1.2.2 pgoyette fi
257 1.1.1.1.2.2 pgoyette
258 1.1.1.1.2.2 pgoyette cat <<EOF
259 1.1.1.1.2.2 pgoyette /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
260 1.1.1.1.2.2 pgoyette
261 1.1.1.1.2.2 pgoyette Copying and distribution of this script, with or without modification,
262 1.1.1.1.2.2 pgoyette are permitted in any medium without royalty provided the copyright
263 1.1.1.1.2.2 pgoyette notice and this notice are preserved. */
264 1.1.1.1.2.2 pgoyette
265 1.1.1.1.2.2 pgoyette OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
266 1.1.1.1.2.2 pgoyette "${LITTLE_OUTPUT_FORMAT}")
267 1.1.1.1.2.2 pgoyette OUTPUT_ARCH(${OUTPUT_ARCH})
268 1.1.1.1.2.2 pgoyette ${RELOCATING+ENTRY(${ENTRY})}
269 1.1.1.1.2.2 pgoyette
270 1.1.1.1.2.2 pgoyette ${RELOCATING+${EXECUTABLE_SYMBOLS}}
271 1.1.1.1.2.2 pgoyette ${RELOCATING+${INPUT_FILES}}
272 1.1.1.1.2.2 pgoyette ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
273 1.1.1.1.2.2 pgoyette if gld -r is used and the intermediate file has sections starting
274 1.1.1.1.2.2 pgoyette at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
275 1.1.1.1.2.2 pgoyette bug. But for now assigning the zero vmas works. */}
276 1.1.1.1.2.2 pgoyette
277 1.1.1.1.2.2 pgoyette
278 1.1.1.1.2.2 pgoyette
279 1.1.1.1.2.2 pgoyette /* BSP specific*/
280 1.1.1.1.2.2 pgoyette __PROG_SIZE_FOR_CORE__ = 1M;
281 1.1.1.1.2.2 pgoyette __HEAP_SIZE_FOR_CORE__ = 1M;
282 1.1.1.1.2.2 pgoyette
283 1.1.1.1.2.2 pgoyette __MAX_NUM_CORES_IN_ROWS__ = 4;
284 1.1.1.1.2.2 pgoyette __MAX_NUM_CORES_IN_COLS__ = 4;
285 1.1.1.1.2.2 pgoyette
286 1.1.1.1.2.2 pgoyette __FIRST_CORE_ROW_ = 0x20;
287 1.1.1.1.2.2 pgoyette __FIRST_CORE_COL_ = 0x24;
288 1.1.1.1.2.2 pgoyette
289 1.1.1.1.2.2 pgoyette
290 1.1.1.1.2.2 pgoyette
291 1.1.1.1.2.2 pgoyette PROVIDE (__CORE_ROW_ = __FIRST_CORE_ROW_);
292 1.1.1.1.2.2 pgoyette PROVIDE (__CORE_COL_ = __FIRST_CORE_COL_);
293 1.1.1.1.2.2 pgoyette /* generic don't touch */
294 1.1.1.1.2.2 pgoyette /* used to calculated the slice address in the external memory*/
295 1.1.1.1.2.2 pgoyette __CORE_NUM_ = (__CORE_ROW_ - __FIRST_CORE_ROW_ )* __MAX_NUM_CORES_IN_COLS__ + (__CORE_COL_ - __FIRST_CORE_COL_ ) ;
296 1.1.1.1.2.2 pgoyette
297 1.1.1.1.2.2 pgoyette
298 1.1.1.1.2.2 pgoyette MEMORY
299 1.1.1.1.2.2 pgoyette {
300 1.1.1.1.2.2 pgoyette EXTERNAL_DRAM_0 (WXAI) : ORIGIN = 0x80000000, LENGTH = 0x1000000 /*.text, data, rodata, bss and .stack*/
301 1.1.1.1.2.2 pgoyette EXTERNAL_DRAM_1 (WXAI) : ORIGIN = 0x81000000, LENGTH = 0x1000000 /*.heap */
302 1.1.1.1.2.2 pgoyette
303 1.1.1.1.2.2 pgoyette EXTERNAL_SRAM (WXAI) : ORIGIN = 0x92000000, LENGTH = 8K /* small external RAM, used for testing*/
304 1.1.1.1.2.2 pgoyette
305 1.1.1.1.2.2 pgoyette /* run time lib and crt0*/
306 1.1.1.1.2.2 pgoyette RESERVED_CRT0_RAM (WXAI) : ORIGIN = 0, LENGTH = 0x400
307 1.1.1.1.2.2 pgoyette
308 1.1.1.1.2.2 pgoyette /* user program, per bank usage */
309 1.1.1.1.2.2 pgoyette BANK0_SRAM (WXAI) : ORIGIN = LENGTH(RESERVED_CRT0_RAM), LENGTH = 8K - LENGTH(RESERVED_CRT0_RAM)
310 1.1.1.1.2.2 pgoyette BANK1_SRAM (WXAI) : ORIGIN = 0x2000, LENGTH = 8K
311 1.1.1.1.2.2 pgoyette BANK2_SRAM (WXAI) : ORIGIN = 0x4000, LENGTH = 8K
312 1.1.1.1.2.2 pgoyette BANK3_SRAM (WXAI) : ORIGIN = 0x6000, LENGTH = 8K
313 1.1.1.1.2.2 pgoyette
314 1.1.1.1.2.2 pgoyette /* user program, continious placement */
315 1.1.1.1.2.2 pgoyette INTERNAL_RAM (WXAI) : ORIGIN = LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K - LENGTH(RESERVED_CRT0_RAM)
316 1.1.1.1.2.2 pgoyette
317 1.1.1.1.2.2 pgoyette MMR (WAI) : ORIGIN = 0xF000, LENGTH = 32K
318 1.1.1.1.2.2 pgoyette
319 1.1.1.1.2.2 pgoyette /* multi cores space */
320 1.1.1.1.2.2 pgoyette CORE_0x20_0x24_INTERNAL_RAM : ORIGIN = 0x82400000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
321 1.1.1.1.2.2 pgoyette CORE_0x20_0x25_INTERNAL_RAM : ORIGIN = 0x82500000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
322 1.1.1.1.2.2 pgoyette CORE_0x20_0x26_INTERNAL_RAM : ORIGIN = 0x82600000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
323 1.1.1.1.2.2 pgoyette CORE_0x20_0x27_INTERNAL_RAM : ORIGIN = 0x82700000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
324 1.1.1.1.2.2 pgoyette CORE_0x21_0x24_INTERNAL_RAM : ORIGIN = 0x86400000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
325 1.1.1.1.2.2 pgoyette CORE_0x21_0x25_INTERNAL_RAM : ORIGIN = 0x86500000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
326 1.1.1.1.2.2 pgoyette CORE_0x21_0x26_INTERNAL_RAM : ORIGIN = 0x86600000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
327 1.1.1.1.2.2 pgoyette CORE_0x21_0x27_INTERNAL_RAM : ORIGIN = 0x86700000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
328 1.1.1.1.2.2 pgoyette CORE_0x22_0x24_INTERNAL_RAM : ORIGIN = 0x8a400000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
329 1.1.1.1.2.2 pgoyette CORE_0x22_0x25_INTERNAL_RAM : ORIGIN = 0x8a500000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
330 1.1.1.1.2.2 pgoyette CORE_0x22_0x26_INTERNAL_RAM : ORIGIN = 0x8a600000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
331 1.1.1.1.2.2 pgoyette CORE_0x22_0x27_INTERNAL_RAM : ORIGIN = 0x8a700000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
332 1.1.1.1.2.2 pgoyette CORE_0x23_0x24_INTERNAL_RAM : ORIGIN = 0x8e400000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
333 1.1.1.1.2.2 pgoyette CORE_0x23_0x25_INTERNAL_RAM : ORIGIN = 0x8e500000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
334 1.1.1.1.2.2 pgoyette CORE_0x23_0x26_INTERNAL_RAM : ORIGIN = 0x8e600000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
335 1.1.1.1.2.2 pgoyette CORE_0x23_0x27_INTERNAL_RAM : ORIGIN = 0x8e700000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
336 1.1.1.1.2.2 pgoyette CORE_0x24_0x24_INTERNAL_RAM : ORIGIN = 0x82000000+LENGTH(RESERVED_CRT0_RAM), LENGTH = 32K- LENGTH(RESERVED_CRT0_RAM)
337 1.1.1.1.2.2 pgoyette
338 1.1.1.1.2.2 pgoyette }
339 1.1.1.1.2.2 pgoyette
340 1.1.1.1.2.2 pgoyette
341 1.1.1.1.2.2 pgoyette SECTIONS
342 1.1.1.1.2.2 pgoyette {
343 1.1.1.1.2.2 pgoyette
344 1.1.1.1.2.2 pgoyette IVT 0 : {*.o(IVT) } > RESERVED_CRT0_RAM
345 1.1.1.1.2.2 pgoyette RESERVED_CRT0 : {*.o(RESERVED_CRT0) } > RESERVED_CRT0_RAM
346 1.1.1.1.2.2 pgoyette RESERVED_CRT0 : {*.o(reserved_crt0) } > RESERVED_CRT0_RAM
347 1.1.1.1.2.2 pgoyette
348 1.1.1.1.2.2 pgoyette CORE_RAM_0 : {*.o(core_ram_0) } > BANK0_SRAM
349 1.1.1.1.2.2 pgoyette CORE_RAM_1 : {*.o(core_ram_1) } > BANK1_SRAM
350 1.1.1.1.2.2 pgoyette CORE_RAM_2 : {*.o(core_ram_2) } > BANK2_SRAM
351 1.1.1.1.2.2 pgoyette CORE_RAM_3 : {*.o(core_ram_3) } > BANK3_SRAM
352 1.1.1.1.2.2 pgoyette
353 1.1.1.1.2.2 pgoyette SRAM_SOUTH : {*.o(sram) } > EXTERNAL_SRAM
354 1.1.1.1.2.2 pgoyette DRAM_WEST : {*.o(dram) } > EXTERNAL_DRAM_1
355 1.1.1.1.2.2 pgoyette
356 1.1.1.1.2.2 pgoyette CORE_INTERNAL : {*.o(core_ram_internal) } /*> INTERNAL_RAM*/
357 1.1.1.1.2.2 pgoyette
358 1.1.1.1.2.2 pgoyette /* the newlib (libc and libm) library is maped to the dedicated section */
359 1.1.1.1.2.2 pgoyette
360 1.1.1.1.2.2 pgoyette __new_lib_start_external_ = ( ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ *__CORE_NUM_ );
361 1.1.1.1.2.2 pgoyette __new_lib_start_ = DEFINED(__USE_INTERNAL_MEM_FOR_NEW_LIB_) ? ORIGIN(BANK1_SRAM) : __new_lib_start_external_ ;
362 1.1.1.1.2.2 pgoyette
363 1.1.1.1.2.2 pgoyette NEW_LIB_RO ${RELOCATING+__new_lib_start_} : { lib_a-*.o(.text .rodata ) *.o(libgloss_epiphany) } /* > INTERNAL_RAM*/
364 1.1.1.1.2.2 pgoyette GNU_C_BUILTIN_LIB_RO ADDR(NEW_LIB_RO) + SIZEOF(NEW_LIB_RO) : {
365 1.1.1.1.2.2 pgoyette *mulsi3.o(.text .rodata) *modsi3.o(.text .rodata)
366 1.1.1.1.2.2 pgoyette *divsi3.o(.text .rodata) *udivsi3.o(.text .rodata)
367 1.1.1.1.2.2 pgoyette *umodsi3.o(.text .rodata) _*.o(.text .rodata)
368 1.1.1.1.2.2 pgoyette }
369 1.1.1.1.2.2 pgoyette
370 1.1.1.1.2.2 pgoyette NEW_LIB_WR ADDR(GNU_C_BUILTIN_LIB_RO) + SIZEOF(GNU_C_BUILTIN_LIB_RO) : { lib_a-*.o(.data ) } /* > INTERNAL_RAM*/
371 1.1.1.1.2.2 pgoyette
372 1.1.1.1.2.2 pgoyette
373 1.1.1.1.2.2 pgoyette __init_start = DEFINED(__USE_INTERNAL_MEM_) ? ORIGIN(BANK1_SRAM) : (ADDR(NEW_LIB_WR) + SIZEOF(NEW_LIB_WR) ) ;
374 1.1.1.1.2.2 pgoyette __init_start = DEFINED(__USE_INTERNAL_MEM_FOR_NEW_LIB_) ? ADDR(NEW_LIB_WR) + SIZEOF(NEW_LIB_WR) : __init_start;
375 1.1.1.1.2.2 pgoyette
376 1.1.1.1.2.2 pgoyette
377 1.1.1.1.2.2 pgoyette /* Read-only sections, merged into text segment: */
378 1.1.1.1.2.2 pgoyette /*${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}*/
379 1.1.1.1.2.2 pgoyette ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
380 1.1.1.1.2.2 pgoyette ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
381 1.1.1.1.2.2 pgoyette ${INITIAL_READONLY_SECTIONS}
382 1.1.1.1.2.2 pgoyette .note.gnu.build-id : { *(.note.gnu.build-id) }
383 1.1.1.1.2.2 pgoyette EOF
384 1.1.1.1.2.2 pgoyette
385 1.1.1.1.2.2 pgoyette test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN
386 1.1.1.1.2.2 pgoyette test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC=
387 1.1.1.1.2.2 pgoyette cat > ldscripts/dyntmp.$$ <<EOF
388 1.1.1.1.2.2 pgoyette ${TEXT_DYNAMIC+${DYNAMIC}}
389 1.1.1.1.2.2 pgoyette .hash ${RELOCATING-0} : { *(.hash) }
390 1.1.1.1.2.2 pgoyette .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) }
391 1.1.1.1.2.2 pgoyette .dynsym ${RELOCATING-0} : { *(.dynsym) }
392 1.1.1.1.2.2 pgoyette .dynstr ${RELOCATING-0} : { *(.dynstr) }
393 1.1.1.1.2.2 pgoyette .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
394 1.1.1.1.2.2 pgoyette .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
395 1.1.1.1.2.2 pgoyette .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
396 1.1.1.1.2.2 pgoyette EOF
397 1.1.1.1.2.2 pgoyette
398 1.1.1.1.2.2 pgoyette if [ "x$COMBRELOC" = x ]; then
399 1.1.1.1.2.2 pgoyette COMBRELOCCAT="cat >> ldscripts/dyntmp.$$"
400 1.1.1.1.2.2 pgoyette else
401 1.1.1.1.2.2 pgoyette COMBRELOCCAT="cat > $COMBRELOC"
402 1.1.1.1.2.2 pgoyette fi
403 1.1.1.1.2.2 pgoyette eval $COMBRELOCCAT <<EOF
404 1.1.1.1.2.2 pgoyette .rel.init ${RELOCATING-0} : { *(.rel.init) }
405 1.1.1.1.2.2 pgoyette .rela.init ${RELOCATING-0} : { *(.rela.init) }
406 1.1.1.1.2.2 pgoyette .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
407 1.1.1.1.2.2 pgoyette .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
408 1.1.1.1.2.2 pgoyette .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
409 1.1.1.1.2.2 pgoyette .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
410 1.1.1.1.2.2 pgoyette .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) }
411 1.1.1.1.2.2 pgoyette .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) }
412 1.1.1.1.2.2 pgoyette ${OTHER_READONLY_RELOC_SECTIONS}
413 1.1.1.1.2.2 pgoyette .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+* .rel.gnu.linkonce.d.rel.ro.*}) }
414 1.1.1.1.2.2 pgoyette .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+* .rela.gnu.linkonce.d.rel.ro.*}) }
415 1.1.1.1.2.2 pgoyette .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
416 1.1.1.1.2.2 pgoyette .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
417 1.1.1.1.2.2 pgoyette .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
418 1.1.1.1.2.2 pgoyette .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
419 1.1.1.1.2.2 pgoyette .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
420 1.1.1.1.2.2 pgoyette .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
421 1.1.1.1.2.2 pgoyette .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
422 1.1.1.1.2.2 pgoyette .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
423 1.1.1.1.2.2 pgoyette .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
424 1.1.1.1.2.2 pgoyette .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
425 1.1.1.1.2.2 pgoyette .rel.got ${RELOCATING-0} : { *(.rel.got) }
426 1.1.1.1.2.2 pgoyette .rela.got ${RELOCATING-0} : { *(.rela.got) }
427 1.1.1.1.2.2 pgoyette ${OTHER_GOT_RELOC_SECTIONS}
428 1.1.1.1.2.2 pgoyette ${REL_SDATA}
429 1.1.1.1.2.2 pgoyette ${REL_SBSS}
430 1.1.1.1.2.2 pgoyette ${REL_SDATA2}
431 1.1.1.1.2.2 pgoyette ${REL_SBSS2}
432 1.1.1.1.2.2 pgoyette .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) }
433 1.1.1.1.2.2 pgoyette .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) }
434 1.1.1.1.2.2 pgoyette ${REL_LARGE}
435 1.1.1.1.2.2 pgoyette EOF
436 1.1.1.1.2.2 pgoyette
437 1.1.1.1.2.2 pgoyette if [ -n "$COMBRELOC" ]; then
438 1.1.1.1.2.2 pgoyette cat >> ldscripts/dyntmp.$$ <<EOF
439 1.1.1.1.2.2 pgoyette .rel.dyn ${RELOCATING-0} :
440 1.1.1.1.2.2 pgoyette {
441 1.1.1.1.2.2 pgoyette EOF
442 1.1.1.1.2.2 pgoyette sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
443 1.1.1.1.2.2 pgoyette cat >> ldscripts/dyntmp.$$ <<EOF
444 1.1.1.1.2.2 pgoyette }
445 1.1.1.1.2.2 pgoyette .rela.dyn ${RELOCATING-0} :
446 1.1.1.1.2.2 pgoyette {
447 1.1.1.1.2.2 pgoyette EOF
448 1.1.1.1.2.2 pgoyette sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
449 1.1.1.1.2.2 pgoyette cat >> ldscripts/dyntmp.$$ <<EOF
450 1.1.1.1.2.2 pgoyette }
451 1.1.1.1.2.2 pgoyette EOF
452 1.1.1.1.2.2 pgoyette fi
453 1.1.1.1.2.2 pgoyette
454 1.1.1.1.2.2 pgoyette cat >> ldscripts/dyntmp.$$ <<EOF
455 1.1.1.1.2.2 pgoyette .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
456 1.1.1.1.2.2 pgoyette .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
457 1.1.1.1.2.2 pgoyette ${OTHER_PLT_RELOC_SECTIONS}
458 1.1.1.1.2.2 pgoyette EOF
459 1.1.1.1.2.2 pgoyette
460 1.1.1.1.2.2 pgoyette if test -z "${NON_ALLOC_DYN}"; then
461 1.1.1.1.2.2 pgoyette if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
462 1.1.1.1.2.2 pgoyette cat ldscripts/dyntmp.$$
463 1.1.1.1.2.2 pgoyette else
464 1.1.1.1.2.2 pgoyette if test -z "${NO_REL_RELOCS}"; then
465 1.1.1.1.2.2 pgoyette sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$
466 1.1.1.1.2.2 pgoyette fi
467 1.1.1.1.2.2 pgoyette if test -z "${NO_RELA_RELOCS}"; then
468 1.1.1.1.2.2 pgoyette sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$
469 1.1.1.1.2.2 pgoyette fi
470 1.1.1.1.2.2 pgoyette fi
471 1.1.1.1.2.2 pgoyette rm -f ldscripts/dyntmp.$$
472 1.1.1.1.2.2 pgoyette fi
473 1.1.1.1.2.2 pgoyette
474 1.1.1.1.2.2 pgoyette cat <<EOF
475 1.1.1.1.2.2 pgoyette
476 1.1.1.1.2.2 pgoyette .init __init_start :
477 1.1.1.1.2.2 pgoyette {
478 1.1.1.1.2.2 pgoyette ${RELOCATING+${INIT_START}}
479 1.1.1.1.2.2 pgoyette KEEP (*(.init))
480 1.1.1.1.2.2 pgoyette ${RELOCATING+${INIT_END}}
481 1.1.1.1.2.2 pgoyette } /*> INTERNAL_RAM*/ =${NOP-0}
482 1.1.1.1.2.2 pgoyette
483 1.1.1.1.2.2 pgoyette ${TEXT_PLT+${PLT}}
484 1.1.1.1.2.2 pgoyette ${TINY_READONLY_SECTION}
485 1.1.1.1.2.2 pgoyette
486 1.1.1.1.2.2 pgoyette .fini ${RELOCATING+ADDR(.init)+SIZEOF(.init)} ${RELOCATING-0} :
487 1.1.1.1.2.2 pgoyette {
488 1.1.1.1.2.2 pgoyette ${RELOCATING+${FINI_START}}
489 1.1.1.1.2.2 pgoyette KEEP (*(.fini))
490 1.1.1.1.2.2 pgoyette ${RELOCATING+${FINI_END}}
491 1.1.1.1.2.2 pgoyette } /*> INTERNAL_RAM*/ =${NOP-0}
492 1.1.1.1.2.2 pgoyette
493 1.1.1.1.2.2 pgoyette .text ${RELOCATING+ADDR(.fini)+SIZEOF(.fini)} ${RELOCATING-0} :
494 1.1.1.1.2.2 pgoyette {
495 1.1.1.1.2.2 pgoyette ${RELOCATING+${TEXT_START_SYMBOLS}}
496 1.1.1.1.2.2 pgoyette *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
497 1.1.1.1.2.2 pgoyette /* .gnu.warning sections are handled specially by elf32.em. */
498 1.1.1.1.2.2 pgoyette *(.gnu.warning)
499 1.1.1.1.2.2 pgoyette ${RELOCATING+${OTHER_TEXT_SECTIONS}}
500 1.1.1.1.2.2 pgoyette } /*> INTERNAL_RAM */ =${NOP-0}
501 1.1.1.1.2.2 pgoyette
502 1.1.1.1.2.2 pgoyette ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
503 1.1.1.1.2.2 pgoyette ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
504 1.1.1.1.2.2 pgoyette ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);}
505 1.1.1.1.2.2 pgoyette ${WRITABLE_RODATA-${RODATA}}
506 1.1.1.1.2.2 pgoyette .rodata1 ${RELOCATING-0} : { *(.rodata1) }
507 1.1.1.1.2.2 pgoyette ${CREATE_SHLIB-${SDATA2}}
508 1.1.1.1.2.2 pgoyette ${CREATE_SHLIB-${SBSS2}}
509 1.1.1.1.2.2 pgoyette ${OTHER_READONLY_SECTIONS}
510 1.1.1.1.2.2 pgoyette .eh_frame_hdr : { *(.eh_frame_hdr) }
511 1.1.1.1.2.2 pgoyette .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) }
512 1.1.1.1.2.2 pgoyette .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
513 1.1.1.1.2.2 pgoyette
514 1.1.1.1.2.2 pgoyette /* Adjust the address for the data segment. We want to adjust up to
515 1.1.1.1.2.2 pgoyette the same address within the page on the next page up. */
516 1.1.1.1.2.2 pgoyette ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
517 1.1.1.1.2.2 pgoyette ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
518 1.1.1.1.2.2 pgoyette ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}
519 1.1.1.1.2.2 pgoyette
520 1.1.1.1.2.2 pgoyette /* Exception handling */
521 1.1.1.1.2.2 pgoyette .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) }
522 1.1.1.1.2.2 pgoyette .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
523 1.1.1.1.2.2 pgoyette
524 1.1.1.1.2.2 pgoyette /* Thread Local Storage sections */
525 1.1.1.1.2.2 pgoyette .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
526 1.1.1.1.2.2 pgoyette .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
527 1.1.1.1.2.2 pgoyette
528 1.1.1.1.2.2 pgoyette .preinit_array ${RELOCATING-0} :
529 1.1.1.1.2.2 pgoyette {
530 1.1.1.1.2.2 pgoyette ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}}
531 1.1.1.1.2.2 pgoyette KEEP (*(.preinit_array))
532 1.1.1.1.2.2 pgoyette ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}}
533 1.1.1.1.2.2 pgoyette }
534 1.1.1.1.2.2 pgoyette .init_array ${RELOCATING-0} :
535 1.1.1.1.2.2 pgoyette {
536 1.1.1.1.2.2 pgoyette ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}}
537 1.1.1.1.2.2 pgoyette KEEP (*(SORT(.init_array.*)))
538 1.1.1.1.2.2 pgoyette KEEP (*(.init_array))
539 1.1.1.1.2.2 pgoyette ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}}
540 1.1.1.1.2.2 pgoyette }
541 1.1.1.1.2.2 pgoyette .fini_array ${RELOCATING-0} :
542 1.1.1.1.2.2 pgoyette {
543 1.1.1.1.2.2 pgoyette ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}}
544 1.1.1.1.2.2 pgoyette KEEP (*(.fini_array))
545 1.1.1.1.2.2 pgoyette KEEP (*(SORT(.fini_array.*)))
546 1.1.1.1.2.2 pgoyette ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}}
547 1.1.1.1.2.2 pgoyette }
548 1.1.1.1.2.2 pgoyette ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
549 1.1.1.1.2.2 pgoyette ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
550 1.1.1.1.2.2 pgoyette .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
551 1.1.1.1.2.2 pgoyette
552 1.1.1.1.2.2 pgoyette ${RELOCATING+${DATARELRO}}
553 1.1.1.1.2.2 pgoyette ${OTHER_RELRO_SECTIONS}
554 1.1.1.1.2.2 pgoyette ${TEXT_DYNAMIC-${DYNAMIC}}
555 1.1.1.1.2.2 pgoyette ${DATA_GOT+${RELRO_NOW+${GOT}}}
556 1.1.1.1.2.2 pgoyette ${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
557 1.1.1.1.2.2 pgoyette ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
558 1.1.1.1.2.2 pgoyette ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
559 1.1.1.1.2.2 pgoyette ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
560 1.1.1.1.2.2 pgoyette ${DATA_GOT+${RELRO_NOW-${GOTPLT}}}
561 1.1.1.1.2.2 pgoyette
562 1.1.1.1.2.2 pgoyette ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
563 1.1.1.1.2.2 pgoyette
564 1.1.1.1.2.2 pgoyette .data ${RELOCATING+ADDR(.dtors)+SIZEOF(.dtors)} ${RELOCATING-0} :
565 1.1.1.1.2.2 pgoyette {
566 1.1.1.1.2.2 pgoyette ${RELOCATING+${DATA_START_SYMBOLS}}
567 1.1.1.1.2.2 pgoyette *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
568 1.1.1.1.2.2 pgoyette ${CONSTRUCTING+SORT(CONSTRUCTORS)}
569 1.1.1.1.2.2 pgoyette } /*> INTERNAL_RAM*/
570 1.1.1.1.2.2 pgoyette .data1 ${RELOCATING-0} : { *(.data1) }
571 1.1.1.1.2.2 pgoyette ${WRITABLE_RODATA+${RODATA}}
572 1.1.1.1.2.2 pgoyette ${OTHER_READWRITE_SECTIONS}
573 1.1.1.1.2.2 pgoyette ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
574 1.1.1.1.2.2 pgoyette ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
575 1.1.1.1.2.2 pgoyette ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
576 1.1.1.1.2.2 pgoyette ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS}}}
577 1.1.1.1.2.2 pgoyette ${SDATA_GOT+${GOT}}
578 1.1.1.1.2.2 pgoyette ${SDATA_GOT+${OTHER_GOT_SECTIONS}}
579 1.1.1.1.2.2 pgoyette ${SDATA}
580 1.1.1.1.2.2 pgoyette ${OTHER_SDATA_SECTIONS}
581 1.1.1.1.2.2 pgoyette ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
582 1.1.1.1.2.2 pgoyette /* Align ___bss_start and _end to a multiple of 8 so that we can use strd
583 1.1.1.1.2.2 pgoyette to clear bss. N.B., without adding any extra alignment, we would have
584 1.1.1.1.2.2 pgoyette to clear the bss byte by byte. */
585 1.1.1.1.2.2 pgoyette ${RELOCATING+. = ALIGN(8);}
586 1.1.1.1.2.2 pgoyette ${RELOCATING+___bss_start = .;}
587 1.1.1.1.2.2 pgoyette ${RELOCATING+${OTHER_BSS_SYMBOLS}}
588 1.1.1.1.2.2 pgoyette ${SBSS}
589 1.1.1.1.2.2 pgoyette ${BSS_PLT+${PLT}}
590 1.1.1.1.2.2 pgoyette .bss ${RELOCATING+ADDR(.rodata)+SIZEOF(.rodata)} ${RELOCATING-0} :
591 1.1.1.1.2.2 pgoyette {
592 1.1.1.1.2.2 pgoyette *(.dynbss)
593 1.1.1.1.2.2 pgoyette *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
594 1.1.1.1.2.2 pgoyette *(COMMON)
595 1.1.1.1.2.2 pgoyette /* Align here to ensure that the .bss section occupies space up to
596 1.1.1.1.2.2 pgoyette _end. Align after .bss to ensure correct alignment even if the
597 1.1.1.1.2.2 pgoyette .bss section disappears because there are no input sections.
598 1.1.1.1.2.2 pgoyette FIXME: Why do we need it? When there is no .bss section, we don't
599 1.1.1.1.2.2 pgoyette pad the .data section. */
600 1.1.1.1.2.2 pgoyette ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
601 1.1.1.1.2.2 pgoyette } /*> INTERNAL_RAM*/
602 1.1.1.1.2.2 pgoyette ${OTHER_BSS_SECTIONS}
603 1.1.1.1.2.2 pgoyette ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
604 1.1.1.1.2.2 pgoyette ${RELOCATING+. = ALIGN(${ALIGNMENT});}
605 1.1.1.1.2.2 pgoyette ${LARGE_SECTIONS}
606 1.1.1.1.2.2 pgoyette ${RELOCATING+. = ALIGN(${ALIGNMENT});}
607 1.1.1.1.2.2 pgoyette ${RELOCATING+. = ALIGN(8);}
608 1.1.1.1.2.2 pgoyette ${RELOCATING+${OTHER_END_SYMBOLS}}
609 1.1.1.1.2.2 pgoyette ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
610 1.1.1.1.2.2 pgoyette ${RELOCATING+${DATA_SEGMENT_END}}
611 1.1.1.1.2.2 pgoyette EOF
612 1.1.1.1.2.2 pgoyette
613 1.1.1.1.2.2 pgoyette if test -n "${NON_ALLOC_DYN}"; then
614 1.1.1.1.2.2 pgoyette if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
615 1.1.1.1.2.2 pgoyette cat ldscripts/dyntmp.$$
616 1.1.1.1.2.2 pgoyette else
617 1.1.1.1.2.2 pgoyette if test -z "${NO_REL_RELOCS}"; then
618 1.1.1.1.2.2 pgoyette sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$
619 1.1.1.1.2.2 pgoyette fi
620 1.1.1.1.2.2 pgoyette if test -z "${NO_RELA_RELOCS}"; then
621 1.1.1.1.2.2 pgoyette sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$
622 1.1.1.1.2.2 pgoyette fi
623 1.1.1.1.2.2 pgoyette fi
624 1.1.1.1.2.2 pgoyette rm -f ldscripts/dyntmp.$$
625 1.1.1.1.2.2 pgoyette fi
626 1.1.1.1.2.2 pgoyette
627 1.1.1.1.2.2 pgoyette cat <<EOF
628 1.1.1.1.2.2 pgoyette /* Stabs debugging sections. */
629 1.1.1.1.2.2 pgoyette .stab 0 : { *(.stab) }
630 1.1.1.1.2.2 pgoyette .stabstr 0 : { *(.stabstr) }
631 1.1.1.1.2.2 pgoyette .stab.excl 0 : { *(.stab.excl) }
632 1.1.1.1.2.2 pgoyette .stab.exclstr 0 : { *(.stab.exclstr) }
633 1.1.1.1.2.2 pgoyette .stab.index 0 : { *(.stab.index) }
634 1.1.1.1.2.2 pgoyette .stab.indexstr 0 : { *(.stab.indexstr) }
635 1.1.1.1.2.2 pgoyette
636 1.1.1.1.2.2 pgoyette .comment 0 : { *(.comment) }
637 1.1.1.1.2.2 pgoyette
638 1.1.1.1.2.2 pgoyette EOF
639 1.1.1.1.2.2 pgoyette
640 1.1.1.1.2.2 pgoyette . $srcdir/scripttempl/DWARF.sc
641 1.1.1.1.2.2 pgoyette
642 1.1.1.1.2.2 pgoyette cat <<EOF
643 1.1.1.1.2.2 pgoyette ${TINY_DATA_SECTION}
644 1.1.1.1.2.2 pgoyette ${TINY_BSS_SECTION}
645 1.1.1.1.2.2 pgoyette
646 1.1.1.1.2.2 pgoyette /*${STACK_ADDR+${STACK}}*/
647 1.1.1.1.2.2 pgoyette
648 1.1.1.1.2.2 pgoyette PROVIDE ( __stack_start_ = ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ * __CORE_NUM_ + __PROG_SIZE_FOR_CORE__ - 0x10) ;
649 1.1.1.1.2.2 pgoyette .stack ${RELOCATING+__stack_start_} : { ___stack = .; *(.stack) }
650 1.1.1.1.2.2 pgoyette
651 1.1.1.1.2.2 pgoyette PROVIDE ( ___heap_start = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ );
652 1.1.1.1.2.2 pgoyette /*.heap_start __heap_start_ : { _heap_start_ = .; *(.heap_start) }*/
653 1.1.1.1.2.2 pgoyette
654 1.1.1.1.2.2 pgoyette PROVIDE ( ___heap_end = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ + __HEAP_SIZE_FOR_CORE__ - 4 );
655 1.1.1.1.2.2 pgoyette
656 1.1.1.1.2.2 pgoyette
657 1.1.1.1.2.2 pgoyette /* .heap_end __heap_end_ : { _heap_end_ = .; *(.heap_end) }*/
658 1.1.1.1.2.2 pgoyette
659 1.1.1.1.2.2 pgoyette
660 1.1.1.1.2.2 pgoyette ${ATTRS_SECTIONS}
661 1.1.1.1.2.2 pgoyette ${OTHER_SECTIONS}
662 1.1.1.1.2.2 pgoyette ${RELOCATING+${OTHER_SYMBOLS}}
663 1.1.1.1.2.2 pgoyette ${RELOCATING+${DISCARDED}}
664 1.1.1.1.2.2 pgoyette }
665 1.1.1.1.2.2 pgoyette EOF
666