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 ;;
34 # if this is for an embedded system, don't add SIZEOF_HEADERS.
35 if [ -z "$EMBEDDED" ]; then
36 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
38 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
41 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
42 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
43 test "$LD_FLAG" = "N" && DATA_ADDR=.
44 INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
46 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
47 "${LITTLE_OUTPUT_FORMAT}")
51 ${RELOCATING+${LIB_SEARCH_DIRS}}
52 ${RELOCATING+/* Do we need any of these for elf?
53 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
54 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
55 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
56 if gld -r is used and the intermediate file has sections starting
57 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
58 bug. But for now assigning the zero vmas works. */}
61 /* Read-only sections, merged into text segment: */
62 ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}
63 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR} + SIZEOF_HEADERS;}}
64 ${CREATE_SHLIB-${INTERP}}
65 .reginfo ${RELOCATING-0} : { *(.reginfo) }
66 .dynamic ${RELOCATING-0} : { *(.dynamic) }
67 .dynstr ${RELOCATING-0} : { *(.dynstr) }
68 .dynsym ${RELOCATING-0} : { *(.dynsym) }
69 .hash ${RELOCATING-0} : { *(.hash) }
70 .rel.text ${RELOCATING-0} : { *(.rel.text) }
71 .rela.text ${RELOCATING-0} : { *(.rela.text) }
72 .rel.data ${RELOCATING-0} : { *(.rel.data) }
73 .rela.data ${RELOCATING-0} : { *(.rela.data) }
74 .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) }
75 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) }
76 .rel.got ${RELOCATING-0} : { *(.rel.got) }
77 .rela.got ${RELOCATING-0} : { *(.rela.got) }
78 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
79 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
80 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
81 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
82 .rel.init ${RELOCATING-0} : { *(.rel.init) }
83 .rela.init ${RELOCATING-0} : { *(.rela.init) }
84 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
85 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
86 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
87 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
88 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
89 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
90 .rodata ${RELOCATING-0} : { *(.rodata) }
91 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
92 .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
93 .text ${RELOCATING-0} :
95 ${CREATE_SHLIB-${RELOCATING+${TEXT_START_SYMBOLS}}}
98 /* .gnu.warning sections are handled specially by elf32.em. */
101 ${CREATE_SHLIB-${RELOCATING+_etext = .;}}
102 ${CREATE_SHLIB-${RELOCATING+PROVIDE (etext = .);}}
103 .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
105 /* Adjust the address for the data segment. We want to adjust up to
106 the same address within the page on the next page up. It would
107 be more correct to do this:
108 ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE})
109 + ((ALIGN(8) + ${MAXPAGESIZE} - ALIGN(${MAXPAGESIZE}))
110 & (${MAXPAGESIZE} - 1)};}
111 The current expression does not correctly handle the case of a
112 text segment ending precisely at the end of a page; it causes the
113 data segment to skip a page. The above expression does not have
114 this problem, but it will currently (2/95) cause BFD to allocate
115 a single segment, combining both text and data, for this case.
116 This will prevent the text segment from being shared among
117 multiple executions of the program; I think that is more
118 important than losing a page of the virtual address space (note
119 that no actual memory is lost; the page which is skipped can not
121 ${CREATE_SHLIB-${RELOCATING+. += ${DATA_ADDR} - ${TEXT_START_ADDR};}}
122 ${CREATE_SHLIB+${RELOCATING+. += 0x10000;}}
123 .data ${RELOCATING-0} :
125 ${CREATE_SHLIB-${RELOCATING+${DATA_START_SYMBOLS}}}
127 ${CONSTRUCTING+CONSTRUCTORS}
129 .data1 ${RELOCATING-0} : { *(.data1) }
130 .ctors ${RELOCATING-0} : { *(.ctors) }
131 .dtors ${RELOCATING-0} : { *(.dtors) }
132 ${RELOCATING+${OTHER_GOT_SYMBOLS}}
133 .got ${RELOCATING-0} :
137 /* We want the small data sections together, so single-instruction offsets
138 can access them all, and initialized data all before uninitialized, so
139 we can shorten the on-disk segment size. */
140 .sdata ${RELOCATING-0} : { *(.sdata) }
141 ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
142 ${CREATE_SHLIB-${RELOCATING+_edata = .;}}
143 ${CREATE_SHLIB-${RELOCATING+PROVIDE (edata = .);}}
144 ${CREATE_SHLIB-${RELOCATING+__bss_start = .;}}
145 ${CREATE_SHLIB-${RELOCATING+${OTHER_BSS_SYMBOLS}}}
146 .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
147 .bss ${RELOCATING-0} :
153 ${CREATE_SHLIB-${RELOCATING+_end = . ;}}
154 ${CREATE_SHLIB-${RELOCATING+PROVIDE (end = .);}}
156 /* These are needed for ELF backends which have not yet been
157 converted to the new style linker. */
158 .stab 0 : { *(.stab) }
159 .stabstr 0 : { *(.stabstr) }
161 /* DWARF debug sections.
162 Symbols in the .debug DWARF section are relative to the beginning of the
163 section so we begin .debug at 0. It's not clear yet what needs to happen
165 .debug 0 : { *(.debug) }
166 .debug_srcinfo 0 : { *(.debug_srcinfo) }
167 .debug_aranges 0 : { *(.debug_aranges) }
168 .debug_pubnames 0 : { *(.debug_pubnames) }
169 .debug_sfnames 0 : { *(.debug_sfnames) }
170 .line 0 : { *(.line) }
172 /* These must appear regardless of ${RELOCATING}. */