2 # Unusual variables checked by this code:
3 # NOP - two byte opcode for no-op (defaults to 0)
4 # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
5 # OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
6 # (e.g., .PARISC.milli)
7 # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
8 # (e.g., .PARISC.global)
9 # OTHER_SECTIONS - at the end
10 # EXECUTABLE_SYMBOLS - symbols that must be defined for an
11 # executable (e.g., _DYNAMIC_LINK)
12 # TEXT_START_SYMBOLS - symbols that appear at the start of the
14 # DATA_START_SYMBOLS - symbols that appear at the start of the
16 # OTHER_BSS_SYMBOLS - symbols that appear at the start of the
17 # .bss section besides __bss_start.
19 # When adding sections, do note that the names of some sections are used
20 # when specifying the start address of the next.
22 test -z "$ENTRY" && ENTRY=_start
23 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
24 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
25 test "$LD_FLAG" = "N" && DATA_ADDR=.
26 SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }"
27 SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }"
28 INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
29 PLT=".plt ${RELOCATING-0} : { *(.plt) }"
30 CTOR=".ctors ${CONSTRUCTING-0} :
32 ${CONSTRUCTING+${CTOR_START}}
33 /* gcc uses crtbegin.o to find the start of
34 the constructors, so we make sure it is
35 first. Because this is a wildcard, it
36 doesn't matter if the user does not
37 actually link against crtbegin.o; the
38 linker won't look for a file to match a
39 wildcard. The wildcard also means that it
40 doesn't matter which directory crtbegin.o
43 KEEP (*crtbegin.o(.ctors))
45 /* We don't want to include the .ctor section from
46 from the crtend.o file until after the sorted ctors.
47 The .ctor section from the crtend file contains the
48 end of ctors marker and it must be last */
50 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
51 KEEP (*(SORT(.ctors.*)))
53 ${CONSTRUCTING+${CTOR_END}}
56 DTOR=" .dtors ${CONSTRUCTING-0} :
58 ${CONSTRUCTING+${DTOR_START}}
59 KEEP (*crtbegin.o(.dtors))
60 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
61 KEEP (*(SORT(.dtors.*)))
63 ${CONSTRUCTING+${DTOR_END}}
67 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
68 "${LITTLE_OUTPUT_FORMAT}")
72 ${RELOCATING+${LIB_SEARCH_DIRS}}
73 ${RELOCATING+/* Do we need any of these for elf?
74 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
75 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
76 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
77 if gld -r is used and the intermediate file has sections starting
78 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
79 bug. But for now assigning the zero vmas works. */}
81 ${RELOCATING+PROVIDE (__stack = 0);}
82 ${RELOCATING+PROVIDE (___stack = 0);}
85 /* Read-only sections, merged into text segment: */
86 ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
87 ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
88 ${CREATE_SHLIB-${INTERP}}
89 .hash ${RELOCATING-0} : { *(.hash) }
90 .dynsym ${RELOCATING-0} : { *(.dynsym) }
91 .dynstr ${RELOCATING-0} : { *(.dynstr) }
92 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
93 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
94 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
95 .rela.text ${RELOCATING-0} :
98 ${RELOCATING+*(.rela.text.*)}
99 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
101 .rela.data ${RELOCATING-0} :
104 ${RELOCATING+*(.rela.data.*)}
105 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
107 .rela.rodata ${RELOCATING-0} :
110 ${RELOCATING+*(.rela.rodata.*)}
111 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
113 .rela.got ${RELOCATING-0} : { *(.rela.got) }
114 .rela.got1 ${RELOCATING-0} : { *(.rela.got1) }
115 .rela.got2 ${RELOCATING-0} : { *(.rela.got2) }
116 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
117 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
118 .rela.init ${RELOCATING-0} : { *(.rela.init) }
119 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
120 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
121 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
122 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) }
123 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) }
124 .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2) }
125 .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2) }
126 .text ${RELOCATING-0} :
128 ${RELOCATING+${TEXT_START_SYMBOLS}}
130 ${RELOCATING+*(.text.*)}
131 /* .gnu.warning sections are handled specially by elf32.em. */
133 ${RELOCATING+*(.gnu.linkonce.t*)}
135 .init ${RELOCATING-0} : { KEEP (*(.init)) } =${NOP-0}
136 .fini ${RELOCATING-0} : { KEEP (*(.fini)) } =${NOP-0}
137 .rodata ${RELOCATING-0} :
140 ${RELOCATING+*(.rodata.*)}
141 ${RELOCATING+*(.gnu.linkonce.r*)}
143 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
144 ${RELOCATING+_etext = .;}
145 ${RELOCATING+PROVIDE (etext = .);}
146 ${RELOCATING+PROVIDE (__etext = .);}
147 ${CREATE_SHLIB-${SDATA2}}
148 ${CREATE_SHLIB-${SBSS2}}
149 ${RELOCATING+${OTHER_READONLY_SECTIONS}}
151 /* Adjust the address for the data segment. We want to adjust up to
152 the same address within the page on the next page up. It would
153 be more correct to do this:
154 ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};}
155 The current expression does not correctly handle the case of a
156 text segment ending precisely at the end of a page; it causes the
157 data segment to skip a page. The above expression does not have
158 this problem, but it will currently (2/95) cause BFD to allocate
159 a single segment, combining both text and data, for this case.
160 This will prevent the text segment from being shared among
161 multiple executions of the program; I think that is more
162 important than losing a page of the virtual address space (note
163 that no actual memory is lost; the page which is skipped can not
165 ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
167 .data ${RELOCATING-0} :
169 ${RELOCATING+${DATA_START_SYMBOLS}}
171 ${RELOCATING+*(.data.*)}
172 ${RELOCATING+*(.gnu.linkonce.d*)}
173 ${CONSTRUCTING+CONSTRUCTORS}
175 .data1 ${RELOCATING-0} : { *(.data1) }
176 ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
178 .got1 ${RELOCATING-0} : { *(.got1) }
179 .dynamic ${RELOCATING-0} : { *(.dynamic) }
181 /* Put .ctors and .dtors next to the .got2 section, so that the pointers
182 get relocated with -mrelocatable. Also put in the .fixup pointers.
183 The current compiler no longer needs this, but keep it around for 2.7.2 */
185 ${RELOCATING+PROVIDE (_GOT2_START_ = .);}
186 ${RELOCATING+PROVIDE (__GOT2_START_ = .);}
187 .got2 ${RELOCATING-0} : { *(.got2) }
189 ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);}
190 ${RELOCATING+PROVIDE (___CTOR_LIST__ = .);}
191 ${RELOCATING+${CTOR}}
192 ${RELOCATING+PROVIDE (__CTOR_END__ = .);}
193 ${RELOCATING+PROVIDE (___CTOR_END__ = .);}
195 ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);}
196 ${RELOCATING+PROVIDE (___DTOR_LIST__ = .);}
197 ${RELOCATING+${DTOR}}
198 ${RELOCATING+PROVIDE (__DTOR_END__ = .);}
199 ${RELOCATING+PROVIDE (___DTOR_END__ = .);}
201 ${RELOCATING+PROVIDE (_FIXUP_START_ = .);}
202 ${RELOCATING+PROVIDE (__FIXUP_START_ = .);}
203 .fixup ${RELOCATING-0} : { *(.fixup) }
204 ${RELOCATING+PROVIDE (_FIXUP_END_ = .);}
205 ${RELOCATING+PROVIDE (__FIXUP_END_ = .);}
206 ${RELOCATING+PROVIDE (_GOT2_END_ = .);}
207 ${RELOCATING+PROVIDE (__GOT2_END_ = .);}
209 ${RELOCATING+PROVIDE (_GOT_START_ = .);}
210 ${RELOCATING+PROVIDE (__GOT_START_ = .);}
211 .got ${RELOCATING-0} : { *(.got) }
212 .got.plt ${RELOCATING-0} : { *(.got.plt) }
213 ${CREATE_SHLIB+${SDATA2}}
214 ${CREATE_SHLIB+${SBSS2}}
215 ${RELOCATING+PROVIDE (_GOT_END_ = .);}
216 ${RELOCATING+PROVIDE (__GOT_END_ = .);}
218 /* We want the small data sections together, so single-instruction offsets
219 can access them all, and initialized data all before uninitialized, so
220 we can shorten the on-disk segment size. */
221 .sdata ${RELOCATING-0} : { *(.sdata) }
222 ${RELOCATING+_edata = .;}
223 ${RELOCATING+PROVIDE (edata = .);}
224 ${RELOCATING+PROVIDE (__edata = .);}
225 .sbss ${RELOCATING-0} :
227 ${RELOCATING+PROVIDE (__sbss_start = .);}
228 ${RELOCATING+PROVIDE (___sbss_start = .);}
232 ${RELOCATING+PROVIDE (__sbss_end = .);}
233 ${RELOCATING+PROVIDE (___sbss_end = .);}
236 .bss ${RELOCATING-0} :
238 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
239 ${RELOCATING+PROVIDE (__bss_start = .);}
240 ${RELOCATING+PROVIDE (___bss_start = .);}
245 ${RELOCATING+_end = . ;}
246 ${RELOCATING+PROVIDE (end = .);}
247 ${RELOCATING+PROVIDE (__end = .);}
249 /* These are needed for ELF backends which have not yet been
250 converted to the new style linker. */
251 .stab 0 : { *(.stab) }
252 .stabstr 0 : { *(.stabstr) }
254 /* DWARF debug sections.
255 Symbols in the DWARF debugging sections are relative to the beginning
256 of the section so we begin them at 0. */
259 .debug 0 : { *(.debug) }
260 .line 0 : { *(.line) }
262 /* GNU DWARF 1 extensions */
263 .debug_srcinfo 0 : { *(.debug_srcinfo) }
264 .debug_sfnames 0 : { *(.debug_sfnames) }
266 /* DWARF 1.1 and DWARF 2 */
267 .debug_aranges 0 : { *(.debug_aranges) }
268 .debug_pubnames 0 : { *(.debug_pubnames) }
271 .debug_info 0 : { *(.debug_info) }
272 .debug_abbrev 0 : { *(.debug_abbrev) }
273 .debug_line 0 : { *(.debug_line) }
274 .debug_frame 0 : { *(.debug_frame) }
275 .debug_str 0 : { *(.debug_str) }
276 .debug_loc 0 : { *(.debug_loc) }
277 .debug_macinfo 0 : { *(.debug_macinfo) }
279 /* SGI/MIPS DWARF 2 extensions */
280 .debug_weaknames 0 : { *(.debug_weaknames) }
281 .debug_funcnames 0 : { *(.debug_funcnames) }
282 .debug_typenames 0 : { *(.debug_typenames) }
283 .debug_varnames 0 : { *(.debug_varnames) }
285 /* These must appear regardless of ${RELOCATING}. */