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