ldscript revision 1.1.2.2 1 1.1.2.2 mjf /* $NetBSD: ldscript,v 1.1.2.2 2008/02/18 21:04:54 mjf Exp $ */
2 1.1.2.2 mjf
3 1.1.2.2 mjf /* This only differs from the stock one by the addition of the text name
4 1.1.2.2 mjf and the addition of the PHDRS section.
5 1.1.2.2 mjf */
6 1.1.2.2 mjf /* Script for -N: mix text and data on same page; don't align data */
7 1.1.2.2 mjf OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
8 1.1.2.2 mjf "elf32-powerpc")
9 1.1.2.2 mjf OUTPUT_ARCH(powerpc:common)
10 1.1.2.2 mjf ENTRY(_start)
11 1.1.2.2 mjf SEARCH_DIR("/usr/src/tools/ppc-hack/powerpc--netbsd/lib");
12 1.1.2.2 mjf /* Do we need any of these for elf?
13 1.1.2.2 mjf __DYNAMIC = 0; */
14 1.1.2.2 mjf PROVIDE (__stack = 0); PROVIDE (___stack = 0);
15 1.1.2.2 mjf PHDRS
16 1.1.2.2 mjf {
17 1.1.2.2 mjf /* headers PT_PHDR PHDRS ;*/
18 1.1.2.2 mjf text PT_LOAD;
19 1.1.2.2 mjf text PT_NOTE;
20 1.1.2.2 mjf }
21 1.1.2.2 mjf SECTIONS
22 1.1.2.2 mjf {
23 1.1.2.2 mjf /* Read-only sections, merged into text segment: */
24 1.1.2.2 mjf PROVIDE (__executable_start = 0x0); . = 0x0 + SIZEOF_HEADERS;
25 1.1.2.2 mjf .interp : { *(.interp) }
26 1.1.2.2 mjf .hash : { *(.hash) }
27 1.1.2.2 mjf .dynsym : { *(.dynsym) }
28 1.1.2.2 mjf .dynstr : { *(.dynstr) }
29 1.1.2.2 mjf .gnu.version : { *(.gnu.version) }
30 1.1.2.2 mjf .gnu.version_d : { *(.gnu.version_d) }
31 1.1.2.2 mjf .gnu.version_r : { *(.gnu.version_r) }
32 1.1.2.2 mjf .rel.init : { *(.rel.init) }
33 1.1.2.2 mjf .rela.init : { *(.rela.init) }
34 1.1.2.2 mjf .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
35 1.1.2.2 mjf .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
36 1.1.2.2 mjf .rel.fini : { *(.rel.fini) }
37 1.1.2.2 mjf .rela.fini : { *(.rela.fini) }
38 1.1.2.2 mjf .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
39 1.1.2.2 mjf .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
40 1.1.2.2 mjf .rel.data.rel.ro : { *(.rel.data.rel.ro*) }
41 1.1.2.2 mjf .rela.data.rel.ro : { *(.rel.data.rel.ro*) }
42 1.1.2.2 mjf .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
43 1.1.2.2 mjf .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
44 1.1.2.2 mjf .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
45 1.1.2.2 mjf .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
46 1.1.2.2 mjf .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
47 1.1.2.2 mjf .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
48 1.1.2.2 mjf .rel.ctors : { *(.rel.ctors) }
49 1.1.2.2 mjf .rela.ctors : { *(.rela.ctors) }
50 1.1.2.2 mjf .rel.dtors : { *(.rel.dtors) }
51 1.1.2.2 mjf .rela.dtors : { *(.rela.dtors) }
52 1.1.2.2 mjf .rel.got : { *(.rel.got) }
53 1.1.2.2 mjf .rela.got : { *(.rela.got) }
54 1.1.2.2 mjf .rela.got1 : { *(.rela.got1) }
55 1.1.2.2 mjf .rela.got2 : { *(.rela.got2) }
56 1.1.2.2 mjf .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
57 1.1.2.2 mjf .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
58 1.1.2.2 mjf .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
59 1.1.2.2 mjf .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
60 1.1.2.2 mjf .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
61 1.1.2.2 mjf .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
62 1.1.2.2 mjf .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
63 1.1.2.2 mjf .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
64 1.1.2.2 mjf .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
65 1.1.2.2 mjf .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
66 1.1.2.2 mjf .rel.plt : { *(.rel.plt) }
67 1.1.2.2 mjf .rela.plt : { *(.rela.plt) }
68 1.1.2.2 mjf .init :
69 1.1.2.2 mjf {
70 1.1.2.2 mjf KEEP (*(.init))
71 1.1.2.2 mjf } =0
72 1.1.2.2 mjf .text :
73 1.1.2.2 mjf {
74 1.1.2.2 mjf *(.text .stub .text.* .gnu.linkonce.t.*)
75 1.1.2.2 mjf KEEP (*(.text.*personality*))
76 1.1.2.2 mjf /* .gnu.warning sections are handled specially by elf32.em. */
77 1.1.2.2 mjf *(.gnu.warning)
78 1.1.2.2 mjf } :text
79 1.1.2.2 mjf .fini :
80 1.1.2.2 mjf {
81 1.1.2.2 mjf KEEP (*(.fini))
82 1.1.2.2 mjf } =0
83 1.1.2.2 mjf PROVIDE (__etext = .);
84 1.1.2.2 mjf PROVIDE (_etext = .);
85 1.1.2.2 mjf PROVIDE (etext = .);
86 1.1.2.2 mjf .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
87 1.1.2.2 mjf .rodata1 : { *(.rodata1) }
88 1.1.2.2 mjf .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
89 1.1.2.2 mjf .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
90 1.1.2.2 mjf .eh_frame_hdr : { *(.eh_frame_hdr) }
91 1.1.2.2 mjf .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
92 1.1.2.2 mjf .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
93 1.1.2.2 mjf /* Adjust the address for the data segment. We want to adjust up to
94 1.1.2.2 mjf the same address within the page on the next page up. */
95 1.1.2.2 mjf . = .;
96 1.1.2.2 mjf /* Exception handling */
97 1.1.2.2 mjf .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
98 1.1.2.2 mjf .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
99 1.1.2.2 mjf /* Thread Local Storage sections */
100 1.1.2.2 mjf .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
101 1.1.2.2 mjf .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
102 1.1.2.2 mjf /* Ensure the __preinit_array_start label is properly aligned. We
103 1.1.2.2 mjf could instead move the label definition inside the section, but
104 1.1.2.2 mjf the linker would then create the section even if it turns out to
105 1.1.2.2 mjf be empty, which isn't pretty. */
106 1.1.2.2 mjf . = ALIGN(32 / 8);
107 1.1.2.2 mjf PROVIDE (__preinit_array_start = .);
108 1.1.2.2 mjf .preinit_array : { KEEP (*(.preinit_array)) }
109 1.1.2.2 mjf PROVIDE (__preinit_array_end = .);
110 1.1.2.2 mjf PROVIDE (__init_array_start = .);
111 1.1.2.2 mjf .init_array : { KEEP (*(.init_array)) }
112 1.1.2.2 mjf PROVIDE (__init_array_end = .);
113 1.1.2.2 mjf PROVIDE (__fini_array_start = .);
114 1.1.2.2 mjf .fini_array : { KEEP (*(.fini_array)) }
115 1.1.2.2 mjf PROVIDE (__fini_array_end = .);
116 1.1.2.2 mjf .ctors :
117 1.1.2.2 mjf {
118 1.1.2.2 mjf /* gcc uses crtbegin.o to find the start of
119 1.1.2.2 mjf the constructors, so we make sure it is
120 1.1.2.2 mjf first. Because this is a wildcard, it
121 1.1.2.2 mjf doesn't matter if the user does not
122 1.1.2.2 mjf actually link against crtbegin.o; the
123 1.1.2.2 mjf linker won't look for a file to match a
124 1.1.2.2 mjf wildcard. The wildcard also means that it
125 1.1.2.2 mjf doesn't matter which directory crtbegin.o
126 1.1.2.2 mjf is in. */
127 1.1.2.2 mjf KEEP (*crtbegin*.o(.ctors))
128 1.1.2.2 mjf /* We don't want to include the .ctor section from
129 1.1.2.2 mjf from the crtend.o file until after the sorted ctors.
130 1.1.2.2 mjf The .ctor section from the crtend file contains the
131 1.1.2.2 mjf end of ctors marker and it must be last */
132 1.1.2.2 mjf KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
133 1.1.2.2 mjf KEEP (*(SORT(.ctors.*)))
134 1.1.2.2 mjf KEEP (*(.ctors))
135 1.1.2.2 mjf }
136 1.1.2.2 mjf .dtors :
137 1.1.2.2 mjf {
138 1.1.2.2 mjf KEEP (*crtbegin*.o(.dtors))
139 1.1.2.2 mjf KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
140 1.1.2.2 mjf KEEP (*(SORT(.dtors.*)))
141 1.1.2.2 mjf KEEP (*(.dtors))
142 1.1.2.2 mjf }
143 1.1.2.2 mjf .jcr : { KEEP (*(.jcr)) }
144 1.1.2.2 mjf .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
145 1.1.2.2 mjf .fixup : { *(.fixup) }
146 1.1.2.2 mjf .got1 : { *(.got1) }
147 1.1.2.2 mjf .got2 : { *(.got2) }
148 1.1.2.2 mjf .dynamic : { *(.dynamic) }
149 1.1.2.2 mjf .data :
150 1.1.2.2 mjf {
151 1.1.2.2 mjf *(.data .data.* .gnu.linkonce.d.*)
152 1.1.2.2 mjf KEEP (*(.gnu.linkonce.d.*personality*))
153 1.1.2.2 mjf SORT(CONSTRUCTORS)
154 1.1.2.2 mjf }
155 1.1.2.2 mjf .data1 : { *(.data1) }
156 1.1.2.2 mjf .got : { *(.got.plt) *(.got) }
157 1.1.2.2 mjf /* We want the small data sections together, so single-instruction offsets
158 1.1.2.2 mjf can access them all, and initialized data all before uninitialized, so
159 1.1.2.2 mjf we can shorten the on-disk segment size. */
160 1.1.2.2 mjf .sdata :
161 1.1.2.2 mjf {
162 1.1.2.2 mjf *(.sdata .sdata.* .gnu.linkonce.s.*)
163 1.1.2.2 mjf }
164 1.1.2.2 mjf _edata = .;
165 1.1.2.2 mjf PROVIDE (edata = .);
166 1.1.2.2 mjf __bss_start = .;
167 1.1.2.2 mjf .sbss :
168 1.1.2.2 mjf {
169 1.1.2.2 mjf PROVIDE (__sbss_start = .);
170 1.1.2.2 mjf PROVIDE (___sbss_start = .);
171 1.1.2.2 mjf *(.dynsbss)
172 1.1.2.2 mjf *(.sbss .sbss.* .gnu.linkonce.sb.*)
173 1.1.2.2 mjf *(.scommon)
174 1.1.2.2 mjf PROVIDE (__sbss_end = .);
175 1.1.2.2 mjf PROVIDE (___sbss_end = .);
176 1.1.2.2 mjf }
177 1.1.2.2 mjf .plt : { *(.plt) }
178 1.1.2.2 mjf .bss :
179 1.1.2.2 mjf {
180 1.1.2.2 mjf *(.dynbss)
181 1.1.2.2 mjf *(.bss .bss.* .gnu.linkonce.b.*)
182 1.1.2.2 mjf *(COMMON)
183 1.1.2.2 mjf /* Align here to ensure that the .bss section occupies space up to
184 1.1.2.2 mjf _end. Align after .bss to ensure correct alignment even if the
185 1.1.2.2 mjf .bss section disappears because there are no input sections. */
186 1.1.2.2 mjf . = ALIGN(32 / 8);
187 1.1.2.2 mjf }
188 1.1.2.2 mjf . = ALIGN(32 / 8);
189 1.1.2.2 mjf _end = .;
190 1.1.2.2 mjf __end = .;
191 1.1.2.2 mjf PROVIDE (end = .);
192 1.1.2.2 mjf /* Stabs debugging sections. */
193 1.1.2.2 mjf .stab 0 : { *(.stab) }
194 1.1.2.2 mjf .stabstr 0 : { *(.stabstr) }
195 1.1.2.2 mjf .stab.excl 0 : { *(.stab.excl) }
196 1.1.2.2 mjf .stab.exclstr 0 : { *(.stab.exclstr) }
197 1.1.2.2 mjf .stab.index 0 : { *(.stab.index) }
198 1.1.2.2 mjf .stab.indexstr 0 : { *(.stab.indexstr) }
199 1.1.2.2 mjf .comment 0 : { *(.comment) }
200 1.1.2.2 mjf /* DWARF debug sections.
201 1.1.2.2 mjf Symbols in the DWARF debugging sections are relative to the beginning
202 1.1.2.2 mjf of the section so we begin them at 0. */
203 1.1.2.2 mjf /* DWARF 1 */
204 1.1.2.2 mjf .debug 0 : { *(.debug) }
205 1.1.2.2 mjf .line 0 : { *(.line) }
206 1.1.2.2 mjf /* GNU DWARF 1 extensions */
207 1.1.2.2 mjf .debug_srcinfo 0 : { *(.debug_srcinfo) }
208 1.1.2.2 mjf .debug_sfnames 0 : { *(.debug_sfnames) }
209 1.1.2.2 mjf /* DWARF 1.1 and DWARF 2 */
210 1.1.2.2 mjf .debug_aranges 0 : { *(.debug_aranges) }
211 1.1.2.2 mjf .debug_pubnames 0 : { *(.debug_pubnames) }
212 1.1.2.2 mjf /* DWARF 2 */
213 1.1.2.2 mjf .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
214 1.1.2.2 mjf .debug_abbrev 0 : { *(.debug_abbrev) }
215 1.1.2.2 mjf .debug_line 0 : { *(.debug_line) }
216 1.1.2.2 mjf .debug_frame 0 : { *(.debug_frame) }
217 1.1.2.2 mjf .debug_str 0 : { *(.debug_str) }
218 1.1.2.2 mjf .debug_loc 0 : { *(.debug_loc) }
219 1.1.2.2 mjf .debug_macinfo 0 : { *(.debug_macinfo) }
220 1.1.2.2 mjf /* SGI/MIPS DWARF 2 extensions */
221 1.1.2.2 mjf .debug_weaknames 0 : { *(.debug_weaknames) }
222 1.1.2.2 mjf .debug_funcnames 0 : { *(.debug_funcnames) }
223 1.1.2.2 mjf .debug_typenames 0 : { *(.debug_typenames) }
224 1.1.2.2 mjf .debug_varnames 0 : { *(.debug_varnames) }
225 1.1.2.2 mjf /DISCARD/ : { *(.note.GNU-stack) }
226 1.1.2.2 mjf }
227