This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / ld / scripttempl / elf.sc
CommitLineData
267a3ab3
ILT
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
fa247c00 5# OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
267a3ab3 6# (e.g., .PARISC.milli)
fa247c00 7# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
267a3ab3 8# (e.g., .PARISC.global)
31ddb156 9# OTHER_SECTIONS - at the end
267a3ab3
ILT
10# EXECUTABLE_SYMBOLS - symbols that must be defined for an
11# executable (e.g., _DYNAMIC_LINK)
2a9fa50c
ILT
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.
bff600cf
ILT
16# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
17# .bss section besides __bss_start.
2a9fa50c 18# DATA_PLT - .plt should be in data segment, not text segment.
3d046499 19# EMBEDDED - whether this is for an embedded system.
267a3ab3
ILT
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#
fa247c00 24test -z "$ENTRY" && ENTRY=_start
cd1d4f83
ILT
25test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
26test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
18f0961e 27if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
cd1d4f83 28test "$LD_FLAG" = "N" && DATA_ADDR=.
31ddb156 29INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
2a9fa50c 30PLT=".plt ${RELOCATING-0} : { *(.plt) }"
3d046499
ILT
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
f90bb826 39cat <<EOF
cd1d4f83
ILT
40OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
41 "${LITTLE_OUTPUT_FORMAT}")
18f0961e 42OUTPUT_ARCH(${OUTPUT_ARCH})
fa247c00 43ENTRY(${ENTRY})
f90bb826
KR
44
45${RELOCATING+${LIB_SEARCH_DIRS}}
267a3ab3
ILT
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. */}
f90bb826
KR
53SECTIONS
54{
267a3ab3 55 /* Read-only sections, merged into text segment: */
3d046499 56 ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}
31ddb156
ILT
57 ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
58 ${CREATE_SHLIB-${INTERP}}
cd1d4f83
ILT
59 .hash ${RELOCATING-0} : { *(.hash) }
60 .dynsym ${RELOCATING-0} : { *(.dynsym) }
61 .dynstr ${RELOCATING-0} : { *(.dynstr) }
3d046499
ILT
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*) }
cd1d4f83
ILT
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}
2a9fa50c
ILT
92 ${DATA_PLT-${PLT}}
93 .text ${RELOCATING-0} :
f90bb826 94 {
2a9fa50c 95 ${RELOCATING+${TEXT_START_SYMBOLS}}
f90bb826 96 *(.text)
fa247c00
ILT
97 /* .gnu.warning sections are handled specially by elf32.em. */
98 *(.gnu.warning)
3d046499 99 *(.gnu.linkonce.t*)
fa247c00 100 } =${NOP-0}
2a9fa50c 101 ${RELOCATING+_etext = .;}
31ddb156 102 ${RELOCATING+PROVIDE (etext = .);}
2a9fa50c 103 .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
3d046499 104 .rodata ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) }
2a9fa50c 105 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
267a3ab3 106 ${RELOCATING+${OTHER_READONLY_SECTIONS}}
267a3ab3 107
18f0961e
ILT
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. */
3d046499 110 ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};}
18f0961e 111
2a9fa50c 112 .data ${RELOCATING-0} :
f90bb826 113 {
2a9fa50c 114 ${RELOCATING+${DATA_START_SYMBOLS}}
f90bb826 115 *(.data)
3d046499 116 *(.gnu.linkonce.d*)
f90bb826 117 ${CONSTRUCTING+CONSTRUCTORS}
f90bb826 118 }
2a9fa50c 119 .data1 ${RELOCATING-0} : { *(.data1) }
267a3ab3 120 ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
3d046499
ILT
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}}
cd1d4f83 134 .got ${RELOCATING-0} : { *(.got.plt) *(.got) }
2a9fa50c 135 .dynamic ${RELOCATING-0} : { *(.dynamic) }
267a3ab3
ILT
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. */
2a9fa50c 139 .sdata ${RELOCATING-0} : { *(.sdata) }
bff600cf 140 ${RELOCATING+_edata = .;}
31ddb156 141 ${RELOCATING+PROVIDE (edata = .);}
2a9fa50c 142 ${RELOCATING+__bss_start = .;}
bff600cf 143 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
2a9fa50c
ILT
144 .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
145 .bss ${RELOCATING-0} :
f90bb826 146 {
2a9fa50c 147 *(.dynbss)
f90bb826
KR
148 *(.bss)
149 *(COMMON)
f90bb826 150 }
2a9fa50c 151 ${RELOCATING+_end = . ;}
31ddb156
ILT
152 ${RELOCATING+PROVIDE (end = .);}
153
18f0961e 154 /* Stabs debugging sections. */
31ddb156
ILT
155 .stab 0 : { *(.stab) }
156 .stabstr 0 : { *(.stabstr) }
18f0961e
ILT
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.
3d046499
ILT
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 */
18f0961e 169 .debug 0 : { *(.debug) }
3d046499
ILT
170 .line 0 : { *(.line) }
171
172 /* GNU DWARF 1 extensions */
18f0961e 173 .debug_srcinfo 0 : { *(.debug_srcinfo) }
3d046499
ILT
174 .debug_sfnames 0 : { *(.debug_sfnames) }
175
176 /* DWARF 1.1 and DWARF 2 */
18f0961e
ILT
177 .debug_aranges 0 : { *(.debug_aranges) }
178 .debug_pubnames 0 : { *(.debug_pubnames) }
3d046499
ILT
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}}
31ddb156
ILT
196
197 /* These must appear regardless of ${RELOCATING}. */
198 ${OTHER_SECTIONS}
f90bb826
KR
199}
200EOF
This page took 0.450478 seconds and 4 git commands to generate.