ld/
[deliverable/binutils-gdb.git] / ld / scripttempl / elfi370.sc
CommitLineData
5b93d8bb
AM
1#
2# This is just a raw copy of elfppc.sc and has not been otherwise modified
3#
4# Unusual variables checked by this code:
563e308f 5# NOP - four byte opcode for no-op (defaults to 0)
5b93d8bb
AM
6# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
7# OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
8# (e.g., .PARISC.milli)
9# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
10# (e.g., .PARISC.global)
104d59d1 11# ATTRS_SECTIONS - at the end
5b93d8bb
AM
12# OTHER_SECTIONS - at the end
13# EXECUTABLE_SYMBOLS - symbols that must be defined for an
14# executable (e.g., _DYNAMIC_LINK)
15# TEXT_START_SYMBOLS - symbols that appear at the start of the
16# .text section.
17# DATA_START_SYMBOLS - symbols that appear at the start of the
18# .data section.
19# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
20# .bss section besides __bss_start.
21#
22# When adding sections, do note that the names of some sections are used
23# when specifying the start address of the next.
24#
25test -z "$ENTRY" && ENTRY=_start
26test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
27test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
104d59d1 28test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
5b93d8bb 29test "$LD_FLAG" = "N" && DATA_ADDR=.
ec2d9b29
AM
30SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }"
31SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }"
32INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
33PLT=".plt ${RELOCATING-0} : { *(.plt) }"
5b93d8bb
AM
34cat <<EOF
35OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
36 "${LITTLE_OUTPUT_FORMAT}")
37OUTPUT_ARCH(${ARCH})
b34c1498 38${RELOCATING+ENTRY(${ENTRY})}
5b93d8bb
AM
39
40${RELOCATING+${LIB_SEARCH_DIRS}}
41${RELOCATING+/* Do we need any of these for elf?
42 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
43${RELOCATING+${EXECUTABLE_SYMBOLS}}
ec2d9b29
AM
44${RELOCATING- /* For some reason, the Solaris linker makes bad executables
45 if gld -r is used and the intermediate file has sections starting
46 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
47 bug. But for now assigning the zero vmas works. */}
5b93d8bb
AM
48
49${RELOCATING+PROVIDE (__stack = 0);}
50SECTIONS
51{
52 /* Read-only sections, merged into text segment: */
53 ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
54 ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
55 ${CREATE_SHLIB-${INTERP}}
ec2d9b29
AM
56 .hash ${RELOCATING-0} : { *(.hash) }
57 .dynsym ${RELOCATING-0} : { *(.dynsym) }
58 .dynstr ${RELOCATING-0} : { *(.dynstr) }
59 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
60 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
61 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
62 .rela.text ${RELOCATING-0} :
5b93d8bb 63 { *(.rela.text) *(.rela.gnu.linkonce.t*) }
ec2d9b29 64 .rela.data ${RELOCATING-0} :
5b93d8bb 65 { *(.rela.data) *(.rela.gnu.linkonce.d*) }
ec2d9b29 66 .rela.rodata ${RELOCATING-0} :
5b93d8bb 67 { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
ec2d9b29
AM
68 .rela.got ${RELOCATING-0} : { *(.rela.got) }
69 .rela.got1 ${RELOCATING-0} : { *(.rela.got1) }
70 .rela.got2 ${RELOCATING-0} : { *(.rela.got2) }
71 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
72 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
73 .rela.init ${RELOCATING-0} : { *(.rela.init) }
74 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
75 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
76 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
77 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) }
78 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) }
79 .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2) }
80 .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2) }
81 .text ${RELOCATING-0} :
5b93d8bb
AM
82 {
83 ${RELOCATING+${TEXT_START_SYMBOLS}}
84 *(.text)
85 /* .gnu.warning sections are handled specially by elf32.em. */
86 *(.gnu.warning)
87 *(.gnu.linkonce.t*)
88 } =${NOP-0}
ec2d9b29
AM
89 .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
90 .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
91 .rodata ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) }
92 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
5b93d8bb
AM
93 ${RELOCATING+_etext = .;}
94 ${RELOCATING+PROVIDE (etext = .);}
95 ${CREATE_SHLIB-${SDATA2}}
96 ${CREATE_SHLIB-${SBSS2}}
465bc359 97 ${OTHER_READONLY_SECTIONS}
5b93d8bb
AM
98
99 /* Adjust the address for the data segment. We want to adjust up to
100 the same address within the page on the next page up. It would
101 be more correct to do this:
102 ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};}
103 The current expression does not correctly handle the case of a
104 text segment ending precisely at the end of a page; it causes the
105 data segment to skip a page. The above expression does not have
106 this problem, but it will currently (2/95) cause BFD to allocate
107 a single segment, combining both text and data, for this case.
108 This will prevent the text segment from being shared among
109 multiple executions of the program; I think that is more
110 important than losing a page of the virtual address space (note
111 that no actual memory is lost; the page which is skipped can not
112 be referenced). */
113 ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
114
ec2d9b29 115 .data ${RELOCATING-0} :
5b93d8bb
AM
116 {
117 ${RELOCATING+${DATA_START_SYMBOLS}}
118 *(.data)
119 *(.gnu.linkonce.d*)
120 ${CONSTRUCTING+CONSTRUCTORS}
121 }
ec2d9b29 122 .data1 ${RELOCATING-0} : { *(.data1) }
465bc359 123 ${OTHER_READWRITE_SECTIONS}
5b93d8bb 124
ec2d9b29
AM
125 .got1 ${RELOCATING-0} : { *(.got1) }
126 .dynamic ${RELOCATING-0} : { *(.dynamic) }
5b93d8bb
AM
127
128 /* Put .ctors and .dtors next to the .got2 section, so that the pointers
129 get relocated with -mrelocatable. Also put in the .fixup pointers.
130 The current compiler no longer needs this, but keep it around for 2.7.2 */
131
132 ${RELOCATING+PROVIDE (_GOT2_START_ = .);}
ec2d9b29 133 .got2 ${RELOCATING-0} : { *(.got2) }
5b93d8bb
AM
134
135 ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);}
ec2d9b29 136 .ctors ${RELOCATING-0} : { *(.ctors) }
5b93d8bb
AM
137 ${RELOCATING+PROVIDE (__CTOR_END__ = .);}
138
139 ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);}
ec2d9b29 140 .dtors ${RELOCATING-0} : { *(.dtors) }
5b93d8bb
AM
141 ${RELOCATING+PROVIDE (__DTOR_END__ = .);}
142
143 ${RELOCATING+PROVIDE (_FIXUP_START_ = .);}
ec2d9b29 144 .fixup ${RELOCATING-0} : { *(.fixup) }
5b93d8bb
AM
145 ${RELOCATING+PROVIDE (_FIXUP_END_ = .);}
146 ${RELOCATING+PROVIDE (_GOT2_END_ = .);}
147
148 ${RELOCATING+PROVIDE (_GOT_START_ = .);}
ec2d9b29
AM
149 .got ${RELOCATING-0} : { *(.got) }
150 .got.plt ${RELOCATING-0} : { *(.got.plt) }
5b93d8bb
AM
151 ${CREATE_SHLIB+${SDATA2}}
152 ${CREATE_SHLIB+${SBSS2}}
153 ${RELOCATING+PROVIDE (_GOT_END_ = .);}
154
155 /* We want the small data sections together, so single-instruction offsets
156 can access them all, and initialized data all before uninitialized, so
157 we can shorten the on-disk segment size. */
ec2d9b29 158 .sdata ${RELOCATING-0} : { *(.sdata) }
5b93d8bb
AM
159 ${RELOCATING+_edata = .;}
160 ${RELOCATING+PROVIDE (edata = .);}
ec2d9b29 161 .sbss ${RELOCATING-0} :
5b93d8bb
AM
162 {
163 ${RELOCATING+PROVIDE (__sbss_start = .);}
164 *(.sbss)
165 *(.scommon)
166 *(.dynsbss)
167 ${RELOCATING+PROVIDE (__sbss_end = .);}
168 }
169 ${PLT}
ec2d9b29 170 .bss ${RELOCATING-0} :
5b93d8bb
AM
171 {
172 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
173 ${RELOCATING+PROVIDE (__bss_start = .);}
174 *(.dynbss)
175 *(.bss)
176 *(COMMON)
177 }
178 ${RELOCATING+_end = . ;}
179 ${RELOCATING+PROVIDE (end = .);}
180
181 /* These are needed for ELF backends which have not yet been
182 converted to the new style linker. */
183 .stab 0 : { *(.stab) }
184 .stabstr 0 : { *(.stabstr) }
185
ceb0a680
NC
186EOF
187
d061dfac 188. $srcdir/scripttempl/DWARF.sc
ceb0a680
NC
189
190cat <<EOF
104d59d1 191 ${ATTRS_SECTIONS}
5b93d8bb
AM
192 ${OTHER_SECTIONS}
193}
194EOF
This page took 0.709101 seconds and 4 git commands to generate.