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