|
1 |
| -/* |
2 |
| - * Copyright (c) 2005 adresd |
3 |
| - * Copyright (c) 2005 Marcus R. Brown |
4 |
| - * Copyright (c) 2005 James Forshaw |
5 |
| - * Copyright (c) 2005 John Kelley |
6 |
| - * Copyright (c) 2005 Jesper Svennevid |
7 |
| - * All rights reserved. |
8 |
| - * |
9 |
| - * Redistribution and use in source and binary forms, with or without |
10 |
| - * modification, are permitted provided that the following conditions |
11 |
| - * are met: |
12 |
| - * 1. Redistributions of source code must retain the above copyright |
13 |
| - * notice, this list of conditions and the following disclaimer. |
14 |
| - * 2. Redistributions in binary form must reproduce the above copyright |
15 |
| - * notice, this list of conditions and the following disclaimer in the |
16 |
| - * documentation and/or other materials provided with the distribution. |
17 |
| - * 3. The names of the authors may not be used to endorse or promote products |
18 |
| - * derived from this software without specific prior written permission. |
19 |
| - * |
20 |
| - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
21 |
| - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 |
| - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
23 |
| - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
24 |
| - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
25 |
| - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 |
| - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 |
| - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 |
| - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
29 |
| - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 |
| - */ |
31 |
| - |
32 |
| -OUTPUT_ARCH(mips:allegrex) |
33 | 1 | ENTRY(module_start)
|
34 | 2 | SECTIONS
|
35 | 3 | {
|
36 |
| - /* Read-only sections, merged into text segment: */ |
37 |
| - PROVIDE (__executable_start = 0x0); . = 0x0; |
38 |
| - .interp : { *(.interp) } |
39 |
| - .dynamic : { *(.dynamic) } |
40 |
| - .hash : { *(.hash) } |
41 |
| - .dynsym : { *(.dynsym) } |
42 |
| - .dynstr : { *(.dynstr) } |
43 |
| - .gnu.version : { *(.gnu.version) } |
44 |
| - .gnu.version_d : { *(.gnu.version_d) } |
45 |
| - .gnu.version_r : { *(.gnu.version_r) } |
46 |
| - .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } |
47 |
| - .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } |
48 |
| - .rel.init : { *(.rel.init) } |
49 |
| - .rela.init : { *(.rela.init) } |
50 |
| - .rel.fini : { *(.rel.fini) } |
51 |
| - .rela.fini : { *(.rela.fini) } |
52 |
| - /* PSP-specific relocations. */ |
53 |
| - .rel.sceStub.text : { *(.rel.sceStub.text) *(SORT(.rel.sceStub.text.*)) } |
54 |
| - .rel.lib.ent.top : { *(.rel.lib.ent.top) } |
55 |
| - .rel.lib.ent : { *(.rel.lib.ent) } |
56 |
| - .rel.lib.ent.btm : { *(.rel.lib.ent.btm) } |
57 |
| - .rel.lib.stub.top : { *(.rel.lib.stub.top) } |
58 |
| - .rel.lib.stub : { *(.rel.lib.stub) } |
59 |
| - .rel.lib.stub.btm : { *(.rel.lib.stub.btm) } |
60 |
| - .rel.rodata.sceModuleInfo : { *(.rel.rodata.sceModuleInfo) } |
61 |
| - .rel.rodata.sceResident : { *(.rel.rodata.sceResident) } |
62 |
| - .rel.rodata.sceNid : { *(.rel.rodata.sceNid) *(SORT(.rel.rodata.sceNid.*)) } |
63 |
| - .rel.rodata.sceVstub : { *(.rel.rodata.sceVstub) *(SORT(.rel.rodata.sceVstub.*)) } |
64 |
| - .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } |
65 |
| - .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } |
66 |
| - .rel.data.rel.ro : { *(.rel.data.rel.ro*) } |
67 |
| - .rela.data.rel.ro : { *(.rel.data.rel.ro*) } |
68 |
| - .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } |
69 |
| - .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } |
70 |
| - .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } |
71 |
| - .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } |
72 |
| - .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } |
73 |
| - .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } |
74 |
| - .rel.ctors : { *(.rel.ctors) } |
75 |
| - .rela.ctors : { *(.rela.ctors) } |
76 |
| - .rel.dtors : { *(.rel.dtors) } |
77 |
| - .rela.dtors : { *(.rela.dtors) } |
78 |
| - .rel.got : { *(.rel.got) } |
79 |
| - .rela.got : { *(.rela.got) } |
80 |
| - .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } |
81 |
| - .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } |
82 |
| - .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } |
83 |
| - .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } |
84 |
| - .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } |
85 |
| - .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } |
86 |
| - .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } |
87 |
| - .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } |
88 |
| - .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } |
89 |
| - .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } |
90 |
| - .rel.plt : { *(.rel.plt) } |
91 |
| - .rela.plt : { *(.rela.plt) } |
92 |
| - |
93 |
| - /* Start the text section at 0x0 for PRX generation */ |
94 |
| - . = 0; |
95 |
| - |
96 |
| - .text : |
97 |
| - { |
98 |
| - _ftext = . ; |
99 |
| - *(.text .stub .text.* .gnu.linkonce.t.*) |
100 |
| - KEEP (*(.text.*personality*)) |
101 |
| - /* .gnu.warning sections are handled specially by elf32.em. */ |
102 |
| - *(.gnu.warning) |
103 |
| - *(.mips16.fn.*) *(.mips16.call.*) |
104 |
| - } =0 |
105 |
| - .init : |
106 |
| - { |
107 |
| - KEEP (*(.init)) |
108 |
| - } =0 |
109 |
| - .plt : { *(.plt) } |
110 |
| - .fini : |
111 |
| - { |
112 |
| - KEEP (*(.fini)) |
113 |
| - } =0 |
114 |
| - /* PSP library stub functions. */ |
115 |
| - .sceStub.text : { *(.sceStub.text) *(SORT(.sceStub.text.*)) } |
116 |
| - PROVIDE (__etext = .); |
117 |
| - PROVIDE (_etext = .); |
118 |
| - PROVIDE (etext = .); |
119 |
| - /* PSP library entry table and library stub table. */ |
120 |
| - .lib.ent.top : { *(.lib.ent.top) } |
121 |
| - .lib.ent : { *(.lib.ent) } |
122 |
| - .lib.ent.btm : { *(.lib.ent.btm) } |
123 |
| - .lib.stub.top : { *(.lib.stub.top) } |
124 |
| - .lib.stub : { *(.lib.stub) } |
125 |
| - .lib.stub.btm : { *(.lib.stub.btm) } |
126 |
| - /* PSP read-only data for module info, NIDs, and Vstubs. The |
127 |
| - .rodata.sceModuleInfo section must appear before the .rodata section |
128 |
| - otherwise it would get absorbed into .rodata and the PSP bootloader |
129 |
| - would be unable to locate the module info structure. */ |
130 |
| - .rodata.sceModuleInfo : { *(.rodata.sceModuleInfo) } |
131 |
| - .rodata.sceResident : { *(.rodata.sceResident) } |
132 |
| - .rodata.sceNid : { KEEP(*(.rodata.sceNid)) KEEP(*(SORT(.rodata.sceNid.*))) } |
133 |
| - .rodata.sceVstub : { *(.rodata.sceVstub) *(SORT(.rodata.sceVstub.*)) } |
134 |
| - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } |
135 |
| - .rodata1 : { *(.rodata1) } |
136 |
| - .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } |
137 |
| - .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } |
138 |
| - .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } |
139 |
| - |
140 |
| - /* Exception handling */ |
141 |
| - .eh_frame_hdr : |
142 |
| - { |
143 |
| - KEEP(*(.eh_frame_hdr)) |
144 |
| - } |
145 |
| - |
| 4 | + /* PRX format requires text to begin at 0 */ |
| 5 | + .text 0 : { *(.text .text.*) } |
| 6 | + |
| 7 | + /* Sort stubs for convenient ordering */ |
| 8 | + .sceStub.text : { *(.sceStub.text) *(SORT(.sceStub.text.*)) } |
| 9 | + |
| 10 | + /* Keep these sections around, even though they may appear unused to the linker */ |
| 11 | + .lib.ent.top : { KEEP(*(.lib.ent.top)) } |
| 12 | + .lib.ent : { KEEP(*(.lib.ent)) } |
| 13 | + .lib.ent.btm : { KEEP(*(.lib.ent.btm)) } |
| 14 | + .lib.stub.top : { KEEP(*(.lib.stub.top)) } |
| 15 | + .lib.stub : { KEEP(*(.lib.stub)) } |
| 16 | + .lib.stub.btm : { KEEP(*(.lib.stub.btm)) } |
| 17 | + .eh_frame_hdr : { KEEP(*(.eh_frame_hdr)) } |
| 18 | + |
| 19 | + /* Add symbols for LLVM's libunwind */ |
146 | 20 | __eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0;
|
147 | 21 | __eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0;
|
148 |
| - |
149 | 22 | .eh_frame :
|
150 | 23 | {
|
151 | 24 | __eh_frame_start = .;
|
152 | 25 | KEEP(*(.eh_frame))
|
153 | 26 | __eh_frame_end = .;
|
154 | 27 | }
|
155 | 28 |
|
156 |
| - /* Adjust the address for the data segment. We want to adjust up to |
157 |
| - the same address within the page on the next page up. */ |
158 |
| - . = ALIGN(256) + (. & (256 - 1)); |
159 |
| - |
160 |
| - .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } |
161 |
| - /* Thread Local Storage sections */ |
162 |
| - .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } |
163 |
| - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } |
164 |
| - /* Ensure the __preinit_array_start label is properly aligned. We |
165 |
| - could instead move the label definition inside the section, but |
166 |
| - the linker would then create the section even if it turns out to |
167 |
| - be empty, which isn't pretty. */ |
168 |
| - . = ALIGN(32 / 8); |
169 |
| - PROVIDE (__preinit_array_start = .); |
170 |
| - .preinit_array : { KEEP (*(.preinit_array)) } |
171 |
| - PROVIDE (__preinit_array_end = .); |
172 |
| - PROVIDE (__init_array_start = .); |
173 |
| - .init_array : { KEEP (*(.init_array)) } |
174 |
| - PROVIDE (__init_array_end = .); |
175 |
| - PROVIDE (__fini_array_start = .); |
176 |
| - .fini_array : { KEEP (*(.fini_array)) } |
177 |
| - PROVIDE (__fini_array_end = .); |
178 |
| - .ctors : |
179 |
| - { |
180 |
| - /* gcc uses crtbegin.o to find the start of |
181 |
| - the constructors, so we make sure it is |
182 |
| - first. Because this is a wildcard, it |
183 |
| - doesn't matter if the user does not |
184 |
| - actually link against crtbegin.o; the |
185 |
| - linker won't look for a file to match a |
186 |
| - wildcard. The wildcard also means that it |
187 |
| - doesn't matter which directory crtbegin.o |
188 |
| - is in. */ |
189 |
| - KEEP (*crtbegin*.o(.ctors)) |
190 |
| - /* We don't want to include the .ctor section from |
191 |
| - from the crtend.o file until after the sorted ctors. |
192 |
| - The .ctor section from the crtend file contains the |
193 |
| - end of ctors marker and it must be last */ |
194 |
| - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) |
195 |
| - KEEP (*(SORT(.ctors.*))) |
196 |
| - KEEP (*(.ctors)) |
197 |
| - } |
198 |
| - .dtors : |
199 |
| - { |
200 |
| - KEEP (*crtbegin*.o(.dtors)) |
201 |
| - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) |
202 |
| - KEEP (*(SORT(.dtors.*))) |
203 |
| - KEEP (*(.dtors)) |
204 |
| - } |
205 |
| - .jcr : { KEEP (*(.jcr)) } |
206 |
| - .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } |
207 |
| - .data : |
208 |
| - { |
209 |
| - _fdata = . ; |
210 |
| - *(.data .data.* .gnu.linkonce.d.*) |
211 |
| - KEEP (*(.gnu.linkonce.d.*personality*)) |
212 |
| - SORT(CONSTRUCTORS) |
213 |
| - } |
214 |
| - .data1 : { *(.data1) } |
215 |
| - . = .; |
216 |
| - _gp = ALIGN(16) + 0x7ff0; |
217 |
| - .got : { *(.got.plt) *(.got) } |
218 |
| - /* We want the small data sections together, so single-instruction offsets |
219 |
| - can access them all, and initialized data all before uninitialized, so |
220 |
| - we can shorten the on-disk segment size. */ |
221 |
| - .sdata : |
222 |
| - { |
223 |
| - *(.sdata .sdata.* .gnu.linkonce.s.*) |
224 |
| - } |
225 |
| - .lit8 : { *(.lit8) } |
226 |
| - .lit4 : { *(.lit4) } |
227 |
| - _edata = .; |
228 |
| - PROVIDE (edata = .); |
229 |
| - __bss_start = .; |
230 |
| - _fbss = .; |
231 |
| - .sbss : |
232 |
| - { |
233 |
| - PROVIDE (__sbss_start = .); |
234 |
| - PROVIDE (___sbss_start = .); |
235 |
| - *(.dynsbss) |
236 |
| - *(.sbss .sbss.* .gnu.linkonce.sb.*) |
237 |
| - *(.scommon) |
238 |
| - PROVIDE (__sbss_end = .); |
239 |
| - PROVIDE (___sbss_end = .); |
240 |
| - } |
241 |
| - .bss : |
242 |
| - { |
243 |
| - *(.dynbss) |
244 |
| - *(.bss .bss.* .gnu.linkonce.b.*) |
245 |
| - *(COMMON) |
246 |
| - /* Align here to ensure that the .bss section occupies space up to |
247 |
| - _end. Align after .bss to ensure correct alignment even if the |
248 |
| - .bss section disappears because there are no input sections. */ |
249 |
| - . = ALIGN(32 / 8); |
250 |
| - } |
251 |
| - . = ALIGN(32 / 8); |
252 |
| - _end = .; |
253 |
| - PROVIDE (end = .); |
254 |
| - /* Stabs debugging sections. */ |
255 |
| - .stab 0 : { *(.stab) } |
256 |
| - .stabstr 0 : { *(.stabstr) } |
257 |
| - .stab.excl 0 : { *(.stab.excl) } |
258 |
| - .stab.exclstr 0 : { *(.stab.exclstr) } |
259 |
| - .stab.index 0 : { *(.stab.index) } |
260 |
| - .stab.indexstr 0 : { *(.stab.indexstr) } |
261 |
| - .comment 0 : { *(.comment) } |
262 |
| - /* DWARF debug sections. |
263 |
| - Symbols in the DWARF debugging sections are relative to the beginning |
264 |
| - of the section so we begin them at 0. */ |
265 |
| - /* DWARF 1 */ |
266 |
| - .debug 0 : { *(.debug) } |
267 |
| - .line 0 : { *(.line) } |
268 |
| - /* GNU DWARF 1 extensions */ |
269 |
| - .debug_srcinfo 0 : { *(.debug_srcinfo) } |
270 |
| - .debug_sfnames 0 : { *(.debug_sfnames) } |
271 |
| - /* DWARF 1.1 and DWARF 2 */ |
272 |
| - .debug_aranges 0 : { *(.debug_aranges) } |
273 |
| - .debug_pubnames 0 : { *(.debug_pubnames) } |
274 |
| - /* DWARF 2 */ |
275 |
| - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
276 |
| - .debug_abbrev 0 : { *(.debug_abbrev) } |
277 |
| - .debug_line 0 : { *(.debug_line) } |
278 |
| - .debug_frame 0 : { *(.debug_frame) } |
279 |
| - .debug_str 0 : { *(.debug_str) } |
280 |
| - .debug_loc 0 : { *(.debug_loc) } |
281 |
| - .debug_macinfo 0 : { *(.debug_macinfo) } |
282 |
| - /* SGI/MIPS DWARF 2 extensions */ |
283 |
| - .debug_weaknames 0 : { *(.debug_weaknames) } |
284 |
| - .debug_funcnames 0 : { *(.debug_funcnames) } |
285 |
| - .debug_typenames 0 : { *(.debug_typenames) } |
286 |
| - .debug_varnames 0 : { *(.debug_varnames) } |
287 |
| - /DISCARD/ : { *(.comment) *(.pdr) } |
288 |
| - /DISCARD/ : { *(.note.GNU-stack) } |
| 29 | + /* These are explicitly listed to avoid being merged into .rodata */ |
| 30 | + .rodata.sceResident : { *(.rodata.sceResident) } |
| 31 | + .rodata.sceModuleInfo : { *(.rodata.sceModuleInfo) } |
| 32 | + /* Sort NIDs for convenient ordering */ |
| 33 | + .rodata.sceNid : { *(.rodata.sceNid) *(SORT(.rodata.sceNid.*)) } |
289 | 34 | }
|
0 commit comments