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