about summary refs log tree commit diff stats
path: root/gba/gba_pkjb.ld
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-07-11 16:37:21 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-07-11 16:37:21 -0400
commit57afb4058710a978bd7b07a368125d04378c62f1 (patch)
tree7a06f1679f0612c58d5a209a013261ff5ad6cb82 /gba/gba_pkjb.ld
parent004575f7cec14946c1936aceca6efee38b7f8a74 (diff)
downloadgen3uploader-57afb4058710a978bd7b07a368125d04378c62f1.tar.gz
gen3uploader-57afb4058710a978bd7b07a368125d04378c62f1.tar.bz2
gen3uploader-57afb4058710a978bd7b07a368125d04378c62f1.zip
started tweaking with stuff
Diffstat (limited to 'gba/gba_pkjb.ld')
-rw-r--r--gba/gba_pkjb.ld296
1 files changed, 296 insertions, 0 deletions
diff --git a/gba/gba_pkjb.ld b/gba/gba_pkjb.ld new file mode 100644 index 0000000..102cb42 --- /dev/null +++ b/gba/gba_pkjb.ld
@@ -0,0 +1,296 @@
1/* Linker Script Original v1.3 by Jeff Frohwein */
2/* v1.0 - Original release */
3/* v1.1 - Added proper .data section support */
4/* v1.2 - Added support for c++ & iwram overlays */
5/* - Major contributions by Jason Wilkins. */
6/* v1.3 - .ewram section now can be used when */
7/* compiling for MULTIBOOT mode. This fixes */
8/* malloc() in DevKitAdvance which depends */
9/* on __eheap_start instead of end to define*/
10/* the starting location of heap space. */
11/* External global variable __gba_iwram_heap*/
12/* support added to allow labels end, _end, */
13/* & __end__ to point to end of iwram or */
14/* the end of ewram. */
15/* Additions by WinterMute */
16/* v1.4 - .sbss section added for unitialised */
17/* data in ewram */
18/* v1.5 - padding section added to stop EZF */
19/* stripping important data */
20/* v1.6 - added memory sections */
21
22/* This file is released into the public domain */
23/* for commercial or non-commercial use with no */
24/* restrictions placed upon it. */
25
26/* NOTE!!!: This linker script defines the RAM & */
27/* ROM start addresses. In order for it to work */
28/* properly, remove -Ttext and -Tbss linker */
29/* options from your makefile if they are */
30/* present. */
31
32/* You can use the following to view section */
33/* addresses in your .elf file: */
34/* objdump -h file.elf */
35/* Please note that empty sections may incorrectly*/
36/* list the lma address as the vma address for */
37/* some versions of objdump. */
38
39OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
40OUTPUT_ARCH(arm)
41ENTRY(_start)
42
43MEMORY {
44
45 rom : ORIGIN = 0x08000000, LENGTH = 32M
46 iwram : ORIGIN = 0x03000000, LENGTH = 32K
47 ewram : ORIGIN = 0x02000000, LENGTH = 256K
48}
49
50
51
52__text_start = ORIGIN(ewram);
53__eheap_end = ORIGIN(ewram) + LENGTH(ewram);
54__iwram_start = ORIGIN(iwram);
55__iwram_top = ORIGIN(iwram) + LENGTH(iwram);;
56
57__sp_irq = __iwram_top - 0x060;
58__sp_usr = __sp_irq - 0x0a0;
59__irq_flags = 0x03007ff8;
60
61SECTIONS
62{
63 . = __text_start;
64 .init :
65 {
66 KEEP (*(.init))
67 . = ALIGN(4);
68 } >ewram =0xff
69
70 .plt :
71 {
72 *(.plt)
73 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
74 } >ewram
75
76 .text ALIGN (4):
77 {
78 *(EXCLUDE_FILE (*.iwram*) .text)
79 *(.text .stub .text.* .gnu.linkonce.t.*)
80 KEEP (*(.text.*personality*))
81 /* .gnu.warning sections are handled specially by elf32.em. */
82 *(.gnu.warning)
83 *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
84 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
85 } >ewram = 0xff
86
87 __text_end = .;
88 .fini :
89 {
90 KEEP (*(.fini))
91 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
92 } >ewram =0
93
94 .rodata :
95 {
96 *(.rodata)
97 *all.rodata*(*)
98 *(.roda)
99 *(.rodata.*)
100 *(.gnu.linkonce.r*)
101 SORT(CONSTRUCTORS)
102 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
103 } >ewram = 0xff
104
105 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >ewram
106 __exidx_start = .;
107 .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >ewram
108 __exidx_end = .;
109 /* Ensure the __preinit_array_start label is properly aligned. We
110 could instead move the label definition inside the section, but
111 the linker would then create the section even if it turns out to
112 be empty, which isn't pretty. */
113 . = ALIGN(32 / 8);
114 PROVIDE (__preinit_array_start = .);
115 .preinit_array : { KEEP (*(.preinit_array)) } >ewram = 0xff
116 PROVIDE (__preinit_array_end = .);
117 PROVIDE (__init_array_start = .);
118 .init_array : { KEEP (*(.init_array)) } >ewram = 0xff
119 PROVIDE (__init_array_end = .);
120 PROVIDE (__fini_array_start = .);
121 .fini_array : { KEEP (*(.fini_array)) } >ewram = 0xff
122 PROVIDE (__fini_array_end = .);
123 .ctors :
124 {
125 /* gcc uses crtbegin.o to find the start of the constructors, so
126 we make sure it is first. Because this is a wildcard, it
127 doesn't matter if the user does not actually link against
128 crtbegin.o; the linker won't look for a file to match a
129 wildcard. The wildcard also means that it doesn't matter which
130 directory crtbegin.o is in. */
131 KEEP (*crtbegin.o(.ctors))
132 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
133 KEEP (*(SORT(.ctors.*)))
134 KEEP (*(.ctors))
135 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
136 } >ewram = 0
137
138 .dtors :
139 {
140 KEEP (*crtbegin.o(.dtors))
141 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
142 KEEP (*(SORT(.dtors.*)))
143 KEEP (*(.dtors))
144 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
145 } >ewram = 0
146
147 .jcr : { KEEP (*(.jcr)) } >ewram
148 .eh_frame :
149 {
150 KEEP (*(.eh_frame))
151 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
152 } >ewram = 0
153
154 .gcc_except_table :
155 {
156 *(.gcc_except_table)
157 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
158 } >ewram = 0
159
160 __iwram_lma = .;
161
162 .iwram __iwram_start : AT (__iwram_lma)
163 {
164 __iwram_start__ = ABSOLUTE(.) ;
165 *(.iwram)
166 *iwram.*(.text)
167 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
168 __iwram_end__ = ABSOLUTE(.) ;
169 } >iwram = 0xff
170
171 __data_lma = __iwram_lma + SIZEOF(.iwram) ;
172
173 .bss ALIGN(4) (NOLOAD):
174 {
175 __bss_start__ = ABSOLUTE(.);
176 *(.dynbss)
177 *(.gnu.linkonce.b*)
178 *(.bss*)
179 *(COMMON)
180 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
181 __bss_end__ = ABSOLUTE(.) ;
182 }
183
184 .data ALIGN(4) : AT (__data_lma)
185 {
186 __data_start__ = ABSOLUTE(.);
187 *(.data)
188 *(.data.*)
189 *(.gnu.linkonce.d*)
190 CONSTRUCTORS
191 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
192 __data_end__ = ABSOLUTE(.);
193 } >iwram = 0xff
194
195 __iwram_overlay_lma = __data_lma + SIZEOF(.data);
196
197 PROVIDE (edata = .);
198 __iwram_overlay_start = . ;
199
200 OVERLAY ALIGN(4) : NOCROSSREFS AT (__iwram_overlay_lma)
201 {
202 .iwram0 { *(.iwram0) . = ALIGN(4);}
203 .iwram1 { *(.iwram1) . = ALIGN(4);}
204 .iwram2 { *(.iwram2) . = ALIGN(4);}
205 .iwram3 { *(.iwram3) . = ALIGN(4);}
206 .iwram4 { *(.iwram4) . = ALIGN(4);}
207 .iwram5 { *(.iwram5) . = ALIGN(4);}
208 .iwram6 { *(.iwram6) . = ALIGN(4);}
209 .iwram7 { *(.iwram7) . = ALIGN(4);}
210 .iwram8 { *(.iwram8) . = ALIGN(4);}
211 .iwram9 { *(.iwram9) . = ALIGN(4);}
212 } >iwram = 0xff
213
214 __ewram_lma = LOADADDR(.iwram0) + SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9);
215
216 __iwram_overlay_end = __ewram_lma ;
217
218 /* v1.3 */
219 __ewram_start = __ewram_lma ;
220
221 .ewram __ewram_start : AT (__ewram_lma)
222 {
223 *(.ewram)
224 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
225 __ewram_end = ABSOLUTE(.);
226 } >ewram = 0xff
227
228 __ewram_overlay_lma = __ewram_lma + SIZEOF(.ewram);
229
230 .sbss ALIGN(4)(NOLOAD):
231 {
232 __sbss_start__ = ABSOLUTE(.);
233 *(.sbss)
234 . = ALIGN(4);
235 __sbss_end__ = ABSOLUTE(.);
236 __end__ = ABSOLUTE(.);
237 __eheap_start = ABSOLUTE(.);
238 }
239
240 OVERLAY ALIGN(4): NOCROSSREFS AT (__ewram_overlay_lma)
241 {
242 .ewram0 { *(.ewram0) . = ALIGN(4);}
243 .ewram1 { *(.ewram1) . = ALIGN(4);}
244 .ewram2 { *(.ewram2) . = ALIGN(4);}
245 .ewram3 { *(.ewram3) . = ALIGN(4);}
246 .ewram4 { *(.ewram4) . = ALIGN(4);}
247 .ewram5 { *(.ewram5) . = ALIGN(4);}
248 .ewram6 { *(.ewram6) . = ALIGN(4);}
249 .ewram7 { *(.ewram7) . = ALIGN(4);}
250 .ewram8 { *(.ewram8) . = ALIGN(4);}
251 .ewram9 { *(.ewram9) . = ALIGN(4);}
252 } >ewram = 0xff
253 __ewram_overlay_end = ABSOLUTE(.);
254
255 __eheap_start = __ewram_overlay_end ;
256
257 _end = __ewram_overlay_end;
258 __end__ = __ewram_overlay_end;
259 __rom_end__ = __ewram_overlay_end;
260
261 /* Stabs debugging sections. */
262 .stab 0 : { *(.stab) }
263 .stabstr 0 : { *(.stabstr) }
264 .stab.excl 0 : { *(.stab.excl) }
265 .stab.exclstr 0 : { *(.stab.exclstr) }
266 .stab.index 0 : { *(.stab.index) }
267 .stab.indexstr 0 : { *(.stab.indexstr) }
268 .comment 0 : { *(.comment) }
269 /* DWARF debug sections.
270 Symbols in the DWARF debugging sections are relative to the beginning
271 of the section so we begin them at 0. */
272 /* DWARF 1 */
273 .debug 0 : { *(.debug) }
274 .line 0 : { *(.line) }
275 /* GNU DWARF 1 extensions */
276 .debug_srcinfo 0 : { *(.debug_srcinfo) }
277 .debug_sfnames 0 : { *(.debug_sfnames) }
278 /* DWARF 1.1 and DWARF 2 */
279 .debug_aranges 0 : { *(.debug_aranges) }
280 .debug_pubnames 0 : { *(.debug_pubnames) }
281 /* DWARF 2 */
282 .debug_info 0 : { *(.debug_info) }
283 .debug_abbrev 0 : { *(.debug_abbrev) }
284 .debug_line 0 : { *(.debug_line) }
285 .debug_frame 0 : { *(.debug_frame) }
286 .debug_str 0 : { *(.debug_str) }
287 .debug_loc 0 : { *(.debug_loc) }
288 .debug_macinfo 0 : { *(.debug_macinfo) }
289 /* SGI/MIPS DWARF 2 extensions */
290 .debug_weaknames 0 : { *(.debug_weaknames) }
291 .debug_funcnames 0 : { *(.debug_funcnames) }
292 .debug_typenames 0 : { *(.debug_typenames) }
293 .debug_varnames 0 : { *(.debug_varnames) }
294 .stack 0x80000 : { _stack = .; *(.stack) }
295 /* These must appear regardless of . */
296}