This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / ld / scripttempl / elf.sc
... / ...
CommitLineData
1#
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
13# .text section.
14# DATA_START_SYMBOLS - symbols that appear at the start of the
15# .data section.
16# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
17# .bss section besides __bss_start.
18# DATA_PLT - .plt should be in data segment, not text segment.
19# EMBEDDED - whether this is for an embedded system.
20#
21# When adding sections, do note that the names of some sections are used
22# when specifying the start address of the next.
23#
24test -z "$ENTRY" && ENTRY=_start
25test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
26test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
27if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
28test "$LD_FLAG" = "N" && DATA_ADDR=.
29INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
30PLT=".plt ${RELOCATING-0} : { *(.plt) }"
31
32# if this is for an embedded system, don't add SIZEOF_HEADERS.
33if [ -z "$EMBEDDED" ]; then
34 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
35else
36 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
37fi
38
39cat <<EOF
40OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
41 "${LITTLE_OUTPUT_FORMAT}")
42OUTPUT_ARCH(${OUTPUT_ARCH})
43ENTRY(${ENTRY})
44
45${RELOCATING+${LIB_SEARCH_DIRS}}
46${RELOCATING+/* Do we need any of these for elf?
47 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
48${RELOCATING+${EXECUTABLE_SYMBOLS}}
49${RELOCATING- /* For some reason, the Solaris linker makes bad executables
50 if gld -r is used and the intermediate file has sections starting
51 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
52 bug. But for now assigning the zero vmas works. */}
53SECTIONS
54{
55 /* Read-only sections, merged into text segment: */
56 ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}
57 ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
58 ${CREATE_SHLIB-${INTERP}}
59 .hash ${RELOCATING-0} : { *(.hash) }
60 .dynsym ${RELOCATING-0} : { *(.dynsym) }
61 .dynstr ${RELOCATING-0} : { *(.dynstr) }
62 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
63 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
64 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
65 .rel.text ${RELOCATING-0} :
66 { *(.rel.text) *(.rel.gnu.linkonce.t*) }
67 .rela.text ${RELOCATING-0} :
68 { *(.rela.text) *(.rela.gnu.linkonce.t*) }
69 .rel.data ${RELOCATING-0} :
70 { *(.rel.data) *(.rel.gnu.linkonce.d*) }
71 .rela.data ${RELOCATING-0} :
72 { *(.rela.data) *(.rela.gnu.linkonce.d*) }
73 .rel.rodata ${RELOCATING-0} :
74 { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
75 .rela.rodata ${RELOCATING-0} :
76 { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
77 .rel.got ${RELOCATING-0} : { *(.rel.got) }
78 .rela.got ${RELOCATING-0} : { *(.rela.got) }
79 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
80 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
81 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
82 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
83 .rel.init ${RELOCATING-0} : { *(.rel.init) }
84 .rela.init ${RELOCATING-0} : { *(.rela.init) }
85 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
86 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
87 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
88 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
89 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
90 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
91 .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
92 ${DATA_PLT-${PLT}}
93 .text ${RELOCATING-0} :
94 {
95 ${RELOCATING+${TEXT_START_SYMBOLS}}
96 *(.text)
97 /* .gnu.warning sections are handled specially by elf32.em. */
98 *(.gnu.warning)
99 *(.gnu.linkonce.t*)
100 } =${NOP-0}
101 ${RELOCATING+_etext = .;}
102 ${RELOCATING+PROVIDE (etext = .);}
103 .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
104 .rodata ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) }
105 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
106 ${RELOCATING+${OTHER_READONLY_SECTIONS}}
107
108 /* Adjust the address for the data segment. We want to adjust up to
109 the same address within the page on the next page up. */
110 ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};}
111
112 .data ${RELOCATING-0} :
113 {
114 ${RELOCATING+${DATA_START_SYMBOLS}}
115 *(.data)
116 *(.gnu.linkonce.d*)
117 ${CONSTRUCTING+CONSTRUCTORS}
118 }
119 .data1 ${RELOCATING-0} : { *(.data1) }
120 ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
121 .ctors ${RELOCATING-0} :
122 {
123 ${CONSTRUCTING+${CTOR_START}}
124 *(.ctors)
125 ${CONSTRUCTING+${CTOR_END}}
126 }
127 .dtors ${RELOCATING-0} :
128 {
129 ${CONSTRUCTING+${DTOR_START}}
130 *(.dtors)
131 ${CONSTRUCTING+${DTOR_END}}
132 }
133 ${DATA_PLT+${PLT}}
134 .got ${RELOCATING-0} : { *(.got.plt) *(.got) }
135 .dynamic ${RELOCATING-0} : { *(.dynamic) }
136 /* We want the small data sections together, so single-instruction offsets
137 can access them all, and initialized data all before uninitialized, so
138 we can shorten the on-disk segment size. */
139 .sdata ${RELOCATING-0} : { *(.sdata) }
140 ${RELOCATING+_edata = .;}
141 ${RELOCATING+PROVIDE (edata = .);}
142 ${RELOCATING+__bss_start = .;}
143 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
144 .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
145 .bss ${RELOCATING-0} :
146 {
147 *(.dynbss)
148 *(.bss)
149 *(COMMON)
150 }
151 ${RELOCATING+_end = . ;}
152 ${RELOCATING+PROVIDE (end = .);}
153
154 /* Stabs debugging sections. */
155 .stab 0 : { *(.stab) }
156 .stabstr 0 : { *(.stabstr) }
157 .stab.excl 0 : { *(.stab.excl) }
158 .stab.exclstr 0 : { *(.stab.exclstr) }
159 .stab.index 0 : { *(.stab.index) }
160 .stab.indexstr 0 : { *(.stab.indexstr) }
161
162 .comment 0 : { *(.comment) }
163
164 /* DWARF debug sections.
165 Symbols in the DWARF debugging sections are relative to the beginning
166 of the section so we begin them at 0. */
167
168 /* DWARF 1 */
169 .debug 0 : { *(.debug) }
170 .line 0 : { *(.line) }
171
172 /* GNU DWARF 1 extensions */
173 .debug_srcinfo 0 : { *(.debug_srcinfo) }
174 .debug_sfnames 0 : { *(.debug_sfnames) }
175
176 /* DWARF 1.1 and DWARF 2 */
177 .debug_aranges 0 : { *(.debug_aranges) }
178 .debug_pubnames 0 : { *(.debug_pubnames) }
179
180 /* DWARF 2 */
181 .debug_info 0 : { *(.debug_info) }
182 .debug_abbrev 0 : { *(.debug_abbrev) }
183 .debug_line 0 : { *(.debug_line) }
184 .debug_frame 0 : { *(.debug_frame) }
185 .debug_str 0 : { *(.debug_str) }
186 .debug_loc 0 : { *(.debug_loc) }
187 .debug_macinfo 0 : { *(.debug_macinfo) }
188
189 /* SGI/MIPS DWARF 2 extensions */
190 .debug_weaknames 0 : { *(.debug_weaknames) }
191 .debug_funcnames 0 : { *(.debug_funcnames) }
192 .debug_typenames 0 : { *(.debug_typenames) }
193 .debug_varnames 0 : { *(.debug_varnames) }
194
195 ${RELOCATING+${OTHER_RELOCATING_SECTIONS}}
196
197 /* These must appear regardless of ${RELOCATING}. */
198 ${OTHER_SECTIONS}
199}
200EOF
This page took 0.02327 seconds and 4 git commands to generate.