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