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.
18 # EMBEDDED - whether this is for an embedded system.
20 # When adding sections, do note that the names of some sections are used
21 # when specifying the start address of the next.
24 # We use a start address of __start for Irix 5, _start for other
25 # targets. This is for compatibility with Irix 5, and with old MIPS
27 if [ -z "$ENTRY" ]; then
29 mips*-*-irix5*) ENTRY=__start ;;
30 mips*-*-linux*) ENTRY=__start ;;
35 # if this is for an embedded system, don't add SIZEOF_HEADERS.
36 if [ -z "$EMBEDDED" ]; then
37 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
39 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
42 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
43 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
44 test "$LD_FLAG" = "N" && DATA_ADDR=.
45 INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
47 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
48 "${LITTLE_OUTPUT_FORMAT}")
52 ${RELOCATING+${LIB_SEARCH_DIRS}}
53 ${RELOCATING+/* Do we need any of these for elf?
54 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
55 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
56 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
57 if gld -r is used and the intermediate file has sections starting
58 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
59 bug. But for now assigning the zero vmas works. */}
62 /* Read-only sections, merged into text segment: */
63 ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}
64 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR} + SIZEOF_HEADERS;}}
65 ${CREATE_SHLIB-${INTERP}}
66 .reginfo ${RELOCATING-0} : { *(.reginfo) }
67 .dynamic ${RELOCATING-0} : { *(.dynamic) }
68 .dynstr ${RELOCATING-0} : { *(.dynstr) }
69 .dynsym ${RELOCATING-0} : { *(.dynsym) }
70 .hash ${RELOCATING-0} : { *(.hash) }
71 .rel.text ${RELOCATING-0} :
72 { *(.rel.text) *(.rel.gnu.linkonce.t*) }
73 .rela.text ${RELOCATING-0} :
74 { *(.rela.text) *(.rela.gnu.linkonce.t*) }
75 .rel.data ${RELOCATING-0} :
76 { *(.rel.data) *(.rel.gnu.linkonce.d*) }
77 .rela.data ${RELOCATING-0} :
78 { *(.rela.data) *(.rela.gnu.linkonce.d*) }
79 .rel.rodata ${RELOCATING-0} :
80 { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
81 .rela.rodata ${RELOCATING-0} :
82 { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
83 .rel.got ${RELOCATING-0} : { *(.rel.got) }
84 .rela.got ${RELOCATING-0} : { *(.rela.got) }
85 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
86 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
87 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
88 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
89 .rel.init ${RELOCATING-0} : { *(.rel.init) }
90 .rela.init ${RELOCATING-0} : { *(.rela.init) }
91 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
92 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
93 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
94 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
95 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
96 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
97 .rodata ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) }
98 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
99 .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
100 .text ${RELOCATING-0} :
102 ${RELOCATING+${TEXT_START_SYMBOLS}}
105 /* .gnu.warning sections are handled specially by elf32.em. */
109 ${RELOCATING+_etext = .;}
110 ${RELOCATING+PROVIDE (etext = .);}
111 .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
113 /* Adjust the address for the data segment. We want to adjust up to
114 the same address within the page on the next page up. It would
115 be more correct to do this:
116 ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE})
117 + ((ALIGN(8) + ${MAXPAGESIZE} - ALIGN(${MAXPAGESIZE}))
118 & (${MAXPAGESIZE} - 1)};}
119 The current expression does not correctly handle the case of a
120 text segment ending precisely at the end of a page; it causes the
121 data segment to skip a page. The above expression does not have
122 this problem, but it will currently (2/95) cause BFD to allocate
123 a single segment, combining both text and data, for this case.
124 This will prevent the text segment from being shared among
125 multiple executions of the program; I think that is more
126 important than losing a page of the virtual address space (note
127 that no actual memory is lost; the page which is skipped can not
129 ${RELOCATING+. += ${DATA_ADDR} - ${TEXT_START_ADDR};}
130 ${RELOCATING+. += 0x10000;}
131 .data ${RELOCATING-0} :
133 ${RELOCATING+${DATA_START_SYMBOLS}}
136 ${CONSTRUCTING+CONSTRUCTORS}
138 .data1 ${RELOCATING-0} : { *(.data1) }
139 .ctors ${RELOCATING-0} : { *(.ctors) }
140 .dtors ${RELOCATING-0} : { *(.dtors) }
141 ${RELOCATING+${OTHER_GOT_SYMBOLS}}
142 .got ${RELOCATING-0} :
146 /* We want the small data sections together, so single-instruction offsets
147 can access them all, and initialized data all before uninitialized, so
148 we can shorten the on-disk segment size. */
149 .sdata ${RELOCATING-0} : { *(.sdata) }
150 ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
151 ${RELOCATING+_edata = .;}
152 ${RELOCATING+PROVIDE (edata = .);}
153 ${RELOCATING+__bss_start = .;}
154 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
155 .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
156 .bss ${RELOCATING-0} :
162 ${RELOCATING+_end = . ;}
163 ${RELOCATING+PROVIDE (end = .);}
165 /* These are needed for ELF backends which have not yet been
166 converted to the new style linker. */
167 .stab 0 : { *(.stab) }
168 .stabstr 0 : { *(.stabstr) }
170 /* DWARF debug sections.
171 Symbols in the DWARF debugging sections are relative to the beginning
172 of the section so we begin them at 0. */
175 .debug 0 : { *(.debug) }
176 .line 0 : { *(.line) }
178 /* GNU DWARF 1 extensions */
179 .debug_srcinfo 0 : { *(.debug_srcinfo) }
180 .debug_sfnames 0 : { *(.debug_sfnames) }
182 /* DWARF 1.1 and DWARF 2 */
183 .debug_aranges 0 : { *(.debug_aranges) }
184 .debug_pubnames 0 : { *(.debug_pubnames) }
187 .debug_info 0 : { *(.debug_info) }
188 .debug_abbrev 0 : { *(.debug_abbrev) }
189 .debug_line 0 : { *(.debug_line) }
190 .debug_frame 0 : { *(.debug_frame) }
191 .debug_str 0 : { *(.debug_str) }
192 .debug_loc 0 : { *(.debug_loc) }
193 .debug_macinfo 0 : { *(.debug_macinfo) }
195 /* SGI/MIPS DWARF 2 extensions */
196 .debug_weaknames 0 : { *(.debug_weaknames) }
197 .debug_funcnames 0 : { *(.debug_funcnames) }
198 .debug_typenames 0 : { *(.debug_typenames) }
199 .debug_varnames 0 : { *(.debug_varnames) }
201 /* These must appear regardless of ${RELOCATING}. */