Commit | Line | Data |
---|---|---|
e0001a05 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. | |
be2c2e39 BW |
6 | # SMALL_DATA_CTOR - .ctors contains small data. |
7 | # SMALL_DATA_DTOR - .dtors contains small data. | |
e0001a05 NC |
8 | # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start |
9 | # INITIAL_READONLY_SECTIONS - at start of text segment | |
10 | # OTHER_READONLY_SECTIONS - other than .text .init .rodata ... | |
11 | # (e.g., .PARISC.milli) | |
12 | # OTHER_TEXT_SECTIONS - these get put in .text when relocating | |
13 | # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... | |
14 | # (e.g., .PARISC.global) | |
43cd72b9 BW |
15 | # OTHER_RELRO_SECTIONS - other than .data.rel.ro ... |
16 | # (e.g. PPC32 .fixup, .got[12]) | |
e0001a05 NC |
17 | # OTHER_SECTIONS - at the end |
18 | # EXECUTABLE_SYMBOLS - symbols that must be defined for an | |
19 | # executable (e.g., _DYNAMIC_LINK) | |
be2c2e39 BW |
20 | # TEXT_START_ADDR - the first byte of the text segment, after any |
21 | # headers. | |
22 | # TEXT_BASE_ADDRESS - the first byte of the text segment. | |
e0001a05 NC |
23 | # TEXT_START_SYMBOLS - symbols that appear at the start of the |
24 | # .text section. | |
25 | # DATA_START_SYMBOLS - symbols that appear at the start of the | |
26 | # .data section. | |
be2c2e39 BW |
27 | # DATA_END_SYMBOLS - symbols that appear at the end of the |
28 | # writeable data sections. | |
e0001a05 NC |
29 | # OTHER_GOT_SYMBOLS - symbols defined just before .got. |
30 | # OTHER_GOT_SECTIONS - sections just after .got. | |
31 | # OTHER_SDATA_SECTIONS - sections just after .sdata. | |
32 | # OTHER_BSS_SYMBOLS - symbols that appear at the start of the | |
33 | # .bss section besides __bss_start. | |
be2c2e39 BW |
34 | # DATA_PLT - .plt should be in data segment, not text segment. |
35 | # PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement. | |
36 | # BSS_PLT - .plt should be in bss segment | |
e0001a05 NC |
37 | # TEXT_DYNAMIC - .dynamic in text segment, not data segment. |
38 | # EMBEDDED - whether this is for an embedded system. | |
39 | # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set | |
40 | # start address of shared library. | |
41 | # INPUT_FILES - INPUT command of files to always include | |
42 | # WRITABLE_RODATA - if set, the .rodata section should be writable | |
43 | # INIT_START, INIT_END - statements just before and just after | |
44 | # combination of .init sections. | |
45 | # FINI_START, FINI_END - statements just before and just after | |
46 | # combination of .fini sections. | |
47 | # STACK_ADDR - start of a .stack section. | |
827a1c67 | 48 | # OTHER_SYMBOLS - symbols to place right at the end of the script. |
be2c2e39 BW |
49 | # ETEXT_NAME - name of a symbol for the end of the text section, |
50 | # normally etext. | |
51 | # SEPARATE_GOTPLT - if set, .got.plt should be separate output section, | |
52 | # so that .got can be in the RELRO area. It should be set to | |
53 | # the number of bytes in the beginning of .got.plt which can be | |
54 | # in the RELRO area as well. | |
3c173cb1 | 55 | # USER_LABEL_PREFIX - prefix to add to user-visible symbols. |
e0001a05 NC |
56 | # |
57 | # When adding sections, do note that the names of some sections are used | |
58 | # when specifying the start address of the next. | |
59 | # | |
60 | ||
61 | # Many sections come in three flavours. There is the 'real' section, | |
62 | # like ".data". Then there are the per-procedure or per-variable | |
63 | # sections, generated by -ffunction-sections and -fdata-sections in GCC, | |
64 | # and useful for --gc-sections, which for a variable "foo" might be | |
65 | # ".data.foo". Then there are the linkonce sections, for which the linker | |
66 | # eliminates duplicates, which are named like ".gnu.linkonce.d.foo". | |
67 | # The exact correspondences are: | |
68 | # | |
69 | # Section Linkonce section | |
70 | # .text .gnu.linkonce.t.foo | |
71 | # .rodata .gnu.linkonce.r.foo | |
72 | # .data .gnu.linkonce.d.foo | |
73 | # .bss .gnu.linkonce.b.foo | |
74 | # .sdata .gnu.linkonce.s.foo | |
75 | # .sbss .gnu.linkonce.sb.foo | |
76 | # .sdata2 .gnu.linkonce.s2.foo | |
77 | # .sbss2 .gnu.linkonce.sb2.foo | |
78 | # .debug_info .gnu.linkonce.wi.foo | |
79 | # .tdata .gnu.linkonce.td.foo | |
80 | # .tbss .gnu.linkonce.tb.foo | |
3c173cb1 BW |
81 | # .lrodata .gnu.linkonce.lr.foo |
82 | # .ldata .gnu.linkonce.l.foo | |
83 | # .lbss .gnu.linkonce.lb.foo | |
84 | # | |
85 | # plus exception-handling information for Tensilica's XCC compiler: | |
86 | # .xt_except_table .gnu.linkonce.e.foo | |
87 | # .xt_except_desc .gnu.linkonce.h.foo | |
88 | # | |
89 | # plus Xtensa-specific literal sections: | |
90 | # .literal .gnu.linkonce.literal.foo | |
91 | # .lit4 .gnu.linkonce.lit4.foo | |
92 | # | |
93 | # plus Xtensa-specific "property table" sections: | |
94 | # .xt.lit .gnu.linkonce.p.foo | |
95 | # .xt.insn .gnu.linkonce.x.foo (obsolete) | |
96 | # .xt.prop .gnu.linkonce.prop.foo | |
e0001a05 NC |
97 | # |
98 | # Each of these can also have corresponding .rel.* and .rela.* sections. | |
99 | ||
100 | test -z "$ENTRY" && ENTRY=_start | |
be2c2e39 BW |
101 | test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} |
102 | test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
103 | if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi | |
e0001a05 NC |
104 | test -z "${ELFSIZE}" && ELFSIZE=32 |
105 | test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8" | |
106 | test "$LD_FLAG" = "N" && DATA_ADDR=. | |
be2c2e39 | 107 | test -z "${ETEXT_NAME}" && ETEXT_NAME=etext |
43cd72b9 BW |
108 | test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE="" |
109 | test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE="" | |
be2c2e39 | 110 | test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT |
e0001a05 | 111 | DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" |
43cd72b9 | 112 | DATA_SEGMENT_RELRO_END="" |
e0001a05 NC |
113 | DATA_SEGMENT_END="" |
114 | if test -n "${COMMONPAGESIZE}"; then | |
115 | DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" | |
116 | DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);" | |
be2c2e39 | 117 | DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" |
e0001a05 NC |
118 | fi |
119 | INTERP=".interp ${RELOCATING-0} : { *(.interp) }" | |
be2c2e39 BW |
120 | if test -z "$PLT"; then |
121 | PLT=".plt ${RELOCATING-0} : { *(.plt) }" | |
122 | fi | |
3c173cb1 | 123 | test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes |
43cd72b9 | 124 | if test -z "$GOT"; then |
be2c2e39 BW |
125 | if test -z "$SEPARATE_GOTPLT"; then |
126 | GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }" | |
127 | else | |
43cd72b9 | 128 | GOT=".got ${RELOCATING-0} : { *(.got) }" |
be2c2e39 BW |
129 | GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }" |
130 | fi | |
43cd72b9 | 131 | fi |
e0001a05 NC |
132 | DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" |
133 | RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" | |
3c173cb1 | 134 | DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }" |
43cd72b9 | 135 | STACKNOTE="/DISCARD/ : { *(.note.GNU-stack) }" |
e0001a05 NC |
136 | INIT_LIT=".init.literal 0 : { *(.init.literal) }" |
137 | INIT=".init 0 : { *(.init) }" | |
138 | FINI_LIT=".fini.literal 0 : { *(.fini.literal) }" | |
139 | FINI=".fini 0 : { *(.fini) }" | |
140 | if test -z "${NO_SMALL_DATA}"; then | |
141 | SBSS=".sbss ${RELOCATING-0} : | |
142 | { | |
3c173cb1 | 143 | ${RELOCATING+${SBSS_START_SYMBOLS}} |
be2c2e39 | 144 | ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)} |
e0001a05 NC |
145 | *(.dynsbss) |
146 | *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*}) | |
147 | *(.scommon) | |
3c173cb1 | 148 | ${RELOCATING+${SBSS_END_SYMBOLS}} |
e0001a05 NC |
149 | }" |
150 | SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }" | |
151 | SDATA="/* We want the small data sections together, so single-instruction offsets | |
152 | can access them all, and initialized data all before uninitialized, so | |
153 | we can shorten the on-disk segment size. */ | |
154 | .sdata ${RELOCATING-0} : | |
155 | { | |
156 | ${RELOCATING+${SDATA_START_SYMBOLS}} | |
be2c2e39 | 157 | ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)} |
e0001a05 NC |
158 | *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*}) |
159 | }" | |
3c173cb1 BW |
160 | SDATA2=".sdata2 ${RELOCATING-0} : |
161 | { | |
162 | ${RELOCATING+${SDATA2_START_SYMBOLS}} | |
163 | *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) | |
164 | }" | |
e0001a05 NC |
165 | REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) } |
166 | .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }" | |
167 | REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) } | |
168 | .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }" | |
169 | REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) } | |
170 | .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }" | |
171 | REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) } | |
172 | .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }" | |
43cd72b9 BW |
173 | else |
174 | NO_SMALL_DATA=" " | |
e0001a05 | 175 | fi |
be2c2e39 BW |
176 | if test -z "${DATA_GOT}"; then |
177 | if test -n "${NO_SMALL_DATA}"; then | |
178 | DATA_GOT=" " | |
179 | fi | |
180 | fi | |
181 | if test -z "${SDATA_GOT}"; then | |
182 | if test -z "${NO_SMALL_DATA}"; then | |
183 | SDATA_GOT=" " | |
184 | fi | |
185 | fi | |
186 | test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" " | |
3c173cb1 BW |
187 | test "${LARGE_SECTIONS}" = "yes" && REL_LARGE=" |
188 | .rel.ldata ${RELOCATING-0} : { *(.rel.ldata${RELOCATING+ .rel.ldata.* .rel.gnu.linkonce.l.*}) } | |
189 | .rela.ldata ${RELOCATING-0} : { *(.rela.ldata${RELOCATING+ .rela.ldata.* .rela.gnu.linkonce.l.*}) } | |
190 | .rel.lbss ${RELOCATING-0} : { *(.rel.lbss${RELOCATING+ .rel.lbss.* .rel.gnu.linkonce.lb.*}) } | |
191 | .rela.lbss ${RELOCATING-0} : { *(.rela.lbss${RELOCATING+ .rela.lbss.* .rela.gnu.linkonce.lb.*}) } | |
192 | .rel.lrodata ${RELOCATING-0} : { *(.rel.lrodata${RELOCATING+ .rel.lrodata.* .rel.gnu.linkonce.lr.*}) } | |
193 | .rela.lrodata ${RELOCATING-0} : { *(.rela.lrodata${RELOCATING+ .rela.lrodata.* .rela.gnu.linkonce.lr.*}) }" | |
194 | test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS=" | |
195 | .lbss ${RELOCATING-0} : | |
196 | { | |
197 | *(.dynlbss) | |
198 | *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*}) | |
199 | *(LARGE_COMMON) | |
200 | } | |
201 | .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} : | |
202 | { | |
203 | *(.lrodata${RELOCATING+ .lrodata.* .gnu.linkonce.lr.*}) | |
204 | } | |
205 | .ldata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} : | |
206 | { | |
207 | *(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*}) | |
208 | ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);} | |
209 | }" | |
e0001a05 NC |
210 | CTOR=".ctors ${CONSTRUCTING-0} : |
211 | { | |
212 | ${CONSTRUCTING+${CTOR_START}} | |
213 | /* gcc uses crtbegin.o to find the start of | |
214 | the constructors, so we make sure it is | |
215 | first. Because this is a wildcard, it | |
216 | doesn't matter if the user does not | |
217 | actually link against crtbegin.o; the | |
218 | linker won't look for a file to match a | |
219 | wildcard. The wildcard also means that it | |
220 | doesn't matter which directory crtbegin.o | |
221 | is in. */ | |
222 | ||
40cf2291 AM |
223 | KEEP (*crtbegin.o(.ctors)) |
224 | KEEP (*crtbegin?.o(.ctors)) | |
e0001a05 NC |
225 | |
226 | /* We don't want to include the .ctor section from | |
bd6791bc | 227 | the crtend.o file until after the sorted ctors. |
e0001a05 NC |
228 | The .ctor section from the crtend file contains the |
229 | end of ctors marker and it must be last */ | |
230 | ||
40cf2291 | 231 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) |
e0001a05 NC |
232 | KEEP (*(SORT(.ctors.*))) |
233 | KEEP (*(.ctors)) | |
234 | ${CONSTRUCTING+${CTOR_END}} | |
235 | }" | |
236 | DTOR=".dtors ${CONSTRUCTING-0} : | |
237 | { | |
238 | ${CONSTRUCTING+${DTOR_START}} | |
40cf2291 AM |
239 | KEEP (*crtbegin.o(.dtors)) |
240 | KEEP (*crtbegin?.o(.dtors)) | |
241 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) | |
e0001a05 NC |
242 | KEEP (*(SORT(.dtors.*))) |
243 | KEEP (*(.dtors)) | |
244 | ${CONSTRUCTING+${DTOR_END}} | |
245 | }" | |
246 | STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : | |
247 | { | |
248 | ${RELOCATING+_stack = .;} | |
249 | *(.stack) | |
250 | }" | |
251 | ||
252 | # if this is for an embedded system, don't add SIZEOF_HEADERS. | |
253 | if [ -z "$EMBEDDED" ]; then | |
254 | test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS" | |
255 | else | |
256 | test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}" | |
257 | fi | |
258 | ||
259 | cat <<EOF | |
260 | ENTRY(${ENTRY}) | |
261 | ||
262 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
e0001a05 NC |
263 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} |
264 | ${RELOCATING+${INPUT_FILES}} | |
265 | ${RELOCATING- /* For some reason, the Solaris linker makes bad executables | |
266 | if gld -r is used and the intermediate file has sections starting | |
267 | at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld | |
268 | bug. But for now assigning the zero vmas works. */} | |
269 | ||
270 | SECTIONS | |
271 | { | |
272 | /* Read-only sections, merged into text segment: */ | |
43cd72b9 | 273 | ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}} |
e0001a05 | 274 | ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} |
43cd72b9 | 275 | ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} |
e0001a05 NC |
276 | ${CREATE_SHLIB-${INTERP}} |
277 | ${INITIAL_READONLY_SECTIONS} | |
278 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
279 | .hash ${RELOCATING-0} : { *(.hash) } | |
3c173cb1 | 280 | .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) } |
e0001a05 NC |
281 | .dynsym ${RELOCATING-0} : { *(.dynsym) } |
282 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
283 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
284 | .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) } | |
285 | .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) } | |
286 | ||
287 | EOF | |
288 | if [ "x$COMBRELOC" = x ]; then | |
289 | COMBRELOCCAT=cat | |
290 | else | |
291 | COMBRELOCCAT="cat > $COMBRELOC" | |
292 | fi | |
293 | eval $COMBRELOCCAT <<EOF | |
294 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
295 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
296 | .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) } | |
297 | .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) } | |
298 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } | |
299 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
300 | .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) } | |
301 | .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) } | |
302 | ${OTHER_READONLY_RELOC_SECTIONS} | |
3c173cb1 BW |
303 | .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+* .rel.gnu.linkonce.d.rel.ro.*}) } |
304 | .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+* .rela.gnu.linkonce.d.rel.ro.*}) } | |
e0001a05 NC |
305 | .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) } |
306 | .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) } | |
307 | .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) } | |
308 | .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) } | |
309 | .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) } | |
310 | .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) } | |
311 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } | |
312 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
313 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
314 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
315 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
316 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
317 | ${OTHER_GOT_RELOC_SECTIONS} | |
318 | ${REL_SDATA} | |
319 | ${REL_SBSS} | |
320 | ${REL_SDATA2} | |
321 | ${REL_SBSS2} | |
322 | .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) } | |
323 | .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) } | |
3c173cb1 | 324 | ${REL_LARGE} |
e0001a05 NC |
325 | EOF |
326 | if [ -n "$COMBRELOC" ]; then | |
327 | cat <<EOF | |
328 | .rel.dyn ${RELOCATING-0} : | |
329 | { | |
330 | EOF | |
331 | sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC | |
332 | cat <<EOF | |
333 | } | |
334 | .rela.dyn ${RELOCATING-0} : | |
335 | { | |
336 | EOF | |
337 | sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC | |
338 | cat <<EOF | |
339 | } | |
340 | EOF | |
341 | fi | |
342 | cat <<EOF | |
343 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
344 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
345 | ${OTHER_PLT_RELOC_SECTIONS} | |
346 | ||
347 | ${RELOCATING-$INIT_LIT} | |
348 | ${RELOCATING-$INIT} | |
349 | ||
3c173cb1 BW |
350 | ${TEXT_PLT+${PLT}} |
351 | ${TINY_READONLY_SECTION} | |
e0001a05 NC |
352 | .text ${RELOCATING-0} : |
353 | { | |
354 | *(.got.plt* .plt*) | |
355 | ||
356 | ${RELOCATING+${INIT_START}} | |
357 | ${RELOCATING+KEEP (*(.init.literal))} | |
358 | ${RELOCATING+KEEP (*(.init))} | |
359 | ${RELOCATING+${INIT_END}} | |
360 | ||
361 | ${RELOCATING+${TEXT_START_SYMBOLS}} | |
74869ac7 | 362 | *(.literal .text .stub${RELOCATING+ .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*}) |
43cd72b9 | 363 | KEEP (*(.text.*personality*)) |
e0001a05 NC |
364 | /* .gnu.warning sections are handled specially by elf32.em. */ |
365 | *(.gnu.warning) | |
366 | ${RELOCATING+${OTHER_TEXT_SECTIONS}} | |
367 | ||
368 | ${RELOCATING+${FINI_START}} | |
369 | ${RELOCATING+KEEP (*(.fini.literal))} | |
370 | ${RELOCATING+KEEP (*(.fini))} | |
371 | ${RELOCATING+${FINI_END}} | |
372 | } =${NOP-0} | |
373 | ||
374 | ${RELOCATING-$FINI_LIT} | |
375 | ${RELOCATING-$FINI} | |
376 | ||
be2c2e39 BW |
377 | ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);} |
378 | ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);} | |
379 | ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);} | |
e0001a05 NC |
380 | ${WRITABLE_RODATA-${RODATA}} |
381 | .rodata1 ${RELOCATING-0} : { *(.rodata1) } | |
382 | ${CREATE_SHLIB-${SDATA2}} | |
383 | ${CREATE_SHLIB-${SBSS2}} | |
384 | ${OTHER_READONLY_SECTIONS} | |
385 | .eh_frame_hdr : { *(.eh_frame_hdr) } | |
43cd72b9 | 386 | .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) } |
3c173cb1 | 387 | .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } |
e0001a05 NC |
388 | |
389 | /* Adjust the address for the data segment. We want to adjust up to | |
390 | the same address within the page on the next page up. */ | |
43cd72b9 | 391 | ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}} |
e0001a05 | 392 | ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} |
43cd72b9 BW |
393 | ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} |
394 | ||
395 | /* Exception handling */ | |
396 | .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) } | |
3c173cb1 | 397 | .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } |
43cd72b9 BW |
398 | |
399 | /* Thread Local Storage sections */ | |
400 | .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } | |
401 | .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } | |
e0001a05 | 402 | |
6f2942ed PB |
403 | .preinit_array ${RELOCATING-0} : |
404 | { | |
3c173cb1 | 405 | ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}} |
6f2942ed | 406 | KEEP (*(.preinit_array)) |
3c173cb1 | 407 | ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}} |
6f2942ed PB |
408 | } |
409 | .init_array ${RELOCATING-0} : | |
410 | { | |
3c173cb1 | 411 | ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}} |
6f2942ed PB |
412 | KEEP (*(SORT(.init_array.*))) |
413 | KEEP (*(.init_array)) | |
3c173cb1 | 414 | ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}} |
6f2942ed PB |
415 | } |
416 | .fini_array ${RELOCATING-0} : | |
417 | { | |
3c173cb1 | 418 | ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}} |
6f2942ed PB |
419 | KEEP (*(.fini_array)) |
420 | KEEP (*(SORT(.fini_array.*))) | |
3c173cb1 | 421 | ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}} |
6f2942ed | 422 | } |
be2c2e39 BW |
423 | ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}} |
424 | ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}} | |
43cd72b9 BW |
425 | .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } |
426 | ||
427 | ${RELOCATING+${DATARELRO}} | |
428 | ${OTHER_RELRO_SECTIONS} | |
429 | ${TEXT_DYNAMIC-${DYNAMIC}} | |
be2c2e39 BW |
430 | ${DATA_GOT+${RELRO_NOW+${GOT}}} |
431 | ${DATA_GOT+${RELRO_NOW+${GOTPLT}}} | |
432 | ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}} | |
43cd72b9 | 433 | ${RELOCATING+${DATA_SEGMENT_RELRO_END}} |
be2c2e39 BW |
434 | ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}} |
435 | ${DATA_GOT+${RELRO_NOW-${GOTPLT}}} | |
436 | ||
437 | ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}} | |
43cd72b9 | 438 | |
e0001a05 NC |
439 | .data ${RELOCATING-0} : |
440 | { | |
441 | ${RELOCATING+${DATA_START_SYMBOLS}} | |
442 | *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*}) | |
3c173cb1 | 443 | ${RELOCATING+KEEP (*(.gnu.linkonce.d.*personality*))} |
e0001a05 NC |
444 | ${CONSTRUCTING+SORT(CONSTRUCTORS)} |
445 | } | |
446 | .data1 ${RELOCATING-0} : { *(.data1) } | |
e0001a05 NC |
447 | ${WRITABLE_RODATA+${RODATA}} |
448 | ${OTHER_READWRITE_SECTIONS} | |
be2c2e39 BW |
449 | ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}} |
450 | ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}} | |
451 | ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}} | |
452 | ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS}}} | |
453 | ${SDATA_GOT+${GOT}} | |
454 | ${SDATA_GOT+${OTHER_GOT_SECTIONS}} | |
e0001a05 NC |
455 | ${SDATA} |
456 | ${OTHER_SDATA_SECTIONS} | |
3c173cb1 | 457 | ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}} |
e0001a05 NC |
458 | ${RELOCATING+__bss_start = .;} |
459 | ${RELOCATING+${OTHER_BSS_SYMBOLS}} | |
460 | ${SBSS} | |
be2c2e39 | 461 | ${BSS_PLT+${PLT}} |
e0001a05 NC |
462 | .bss ${RELOCATING-0} : |
463 | { | |
464 | *(.dynbss) | |
465 | *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*}) | |
466 | *(COMMON) | |
467 | /* Align here to ensure that the .bss section occupies space up to | |
468 | _end. Align after .bss to ensure correct alignment even if the | |
3c173cb1 BW |
469 | .bss section disappears because there are no input sections. |
470 | FIXME: Why do we need it? When there is no .bss section, we don't | |
471 | pad the .data section. */ | |
472 | ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);} | |
e0001a05 | 473 | } |
827a1c67 | 474 | ${RELOCATING+${OTHER_BSS_END_SYMBOLS}} |
e0001a05 | 475 | ${RELOCATING+. = ALIGN(${ALIGNMENT});} |
3c173cb1 BW |
476 | ${LARGE_SECTIONS} |
477 | ${RELOCATING+. = ALIGN(${ALIGNMENT});} | |
9f4fb502 | 478 | ${RELOCATING+${OTHER_END_SYMBOLS}} |
3c173cb1 | 479 | ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}} |
e0001a05 NC |
480 | ${RELOCATING+${DATA_SEGMENT_END}} |
481 | ||
482 | /* Stabs debugging sections. */ | |
483 | .stab 0 : { *(.stab) } | |
484 | .stabstr 0 : { *(.stabstr) } | |
485 | .stab.excl 0 : { *(.stab.excl) } | |
486 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
487 | .stab.index 0 : { *(.stab.index) } | |
488 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
489 | ||
490 | .comment 0 : { *(.comment) } | |
491 | ||
492 | /* DWARF debug sections. | |
493 | Symbols in the DWARF debugging sections are relative to the beginning | |
494 | of the section so we begin them at 0. */ | |
495 | ||
496 | /* DWARF 1 */ | |
497 | .debug 0 : { *(.debug) } | |
498 | .line 0 : { *(.line) } | |
499 | ||
500 | /* GNU DWARF 1 extensions */ | |
501 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | |
502 | .debug_sfnames 0 : { *(.debug_sfnames) } | |
503 | ||
504 | /* DWARF 1.1 and DWARF 2 */ | |
505 | .debug_aranges 0 : { *(.debug_aranges) } | |
506 | .debug_pubnames 0 : { *(.debug_pubnames) } | |
507 | ||
508 | /* DWARF 2 */ | |
3c173cb1 | 509 | .debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*}) } |
e0001a05 NC |
510 | .debug_abbrev 0 : { *(.debug_abbrev) } |
511 | .debug_line 0 : { *(.debug_line) } | |
512 | .debug_frame 0 : { *(.debug_frame) } | |
513 | .debug_str 0 : { *(.debug_str) } | |
514 | .debug_loc 0 : { *(.debug_loc) } | |
515 | .debug_macinfo 0 : { *(.debug_macinfo) } | |
516 | ||
517 | /* SGI/MIPS DWARF 2 extensions */ | |
518 | .debug_weaknames 0 : { *(.debug_weaknames) } | |
519 | .debug_funcnames 0 : { *(.debug_funcnames) } | |
520 | .debug_typenames 0 : { *(.debug_typenames) } | |
521 | .debug_varnames 0 : { *(.debug_varnames) } | |
522 | ||
3c173cb1 BW |
523 | ${TINY_DATA_SECTION} |
524 | ${TINY_BSS_SECTION} | |
525 | ||
e0001a05 NC |
526 | ${STACK_ADDR+${STACK}} |
527 | ${OTHER_SECTIONS} | |
827a1c67 | 528 | ${RELOCATING+${OTHER_SYMBOLS}} |
43cd72b9 | 529 | ${RELOCATING+${STACKNOTE}} |
e0001a05 NC |
530 | } |
531 | EOF |