gbasys

view samples/fonts/lnkscript @ 11:2b31bd7e96b4

added panicf
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 01 Feb 2016 02:36:25 +0200
parents
children
line source
1 /* Linker Script 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. */
16 /* This file is released into the public domain */
17 /* for commercial or non-commercial use with no */
18 /* restrictions placed upon it. */
20 /* NOTE!!!: This linker script defines the RAM & */
21 /* ROM start addresses. In order for it to work */
22 /* properly, remove -Ttext and -Tbss linker */
23 /* options from your makefile if they are */
24 /* present. */
26 /* You can use the following to view section */
27 /* addresses in your .elf file: */
28 /* objdump -h file.elf */
29 /* Please note that empty sections may incorrectly*/
30 /* list the lma address as the vma address for */
31 /* some versions of objdump. */
33 OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
34 OUTPUT_ARCH(arm)
35 ENTRY(_start)
36 /* SEARCH_DIR(/bin/arm); */
38 /* By default this linker script will generate code */
39 /* for flash carts located at 0x8000000. In order to */
40 /* generate code that is compiled at 0x2000000 that */
41 /* will run on flash carts or in multiboot mode then */
42 /* you need to add the following variable to your main */
43 /* project file. It's value is NOT important but */
44 /* IT MUST BE A GLOBAL VARIABLE OR IT WILL NOT WORK: */
46 /* #define MULTIBOOT int __gba_multiboot; */
47 /* Then use it like this: MULTIBOOT */
49 /* By default this linker script will set the labels */
50 /* end, _end, & __end__ at the end of ewram. To force */
51 /* them to be set to the end of iwram then you need to */
52 /* add the following variable to your main */
53 /* project file. It's value is NOT important but */
54 /* IT MUST BE A GLOBAL VARIABLE OR IT WILL NOT WORK: */
56 /* #define IWRAMHEAP int __gba_iwram_heap; */
57 /* Then use it like this: IWRAMHEAP */
59 /* The linker script function "var1 += var2;" sometimes */
60 /* reports incorrect values in the *.map file but the */
61 /* actual value it calculates is usually, if not always, */
62 /* correct. If you leave out the ". = ALIGN(4);" at the */
63 /* end of each section then the return value of SIZEOF() */
64 /* is sometimes incorrect and "var1 += var2;" appears to */
65 /* not work as well. "var1 += var2" style functions are */
66 /* avoided below as a result. */
68 /* The linker script MEMORY directive is not used here due */
69 /* to the fact that __text_start is not always a fixed value. */
71 __text_start = DEFINED (__gba_multiboot) ? 0x2000000 : 0x8000000;
72 /* __ewram_start = 0x2000000; */ /* Removed in v1.3 */
73 __eheap_end = 0x2040000;
74 __iwram_start = 0x3000000;
75 __iheap_end = 0x3008000 - 0x400;
76 __sp_usr = 0x3008000 - 0x100;
77 __sp_irq = 0x3008000 - 0x60;
78 __intr_vector_buf = 0x3008000 - 4;
79 __sp_usr_offset = __sp_usr - __iwram_start;
80 __intr_vect_offset = __intr_vector_buf - __sp_usr;
82 SECTIONS
83 {
84 .text __text_start : /* ALIGN (4): */
85 {
86 *(EXCLUDE_FILE (*text.iwram*) .text)
87 *(.text.*)
88 *(.stub)
89 /* .gnu.warning sections are handled specially by elf32.em. */
90 *(.gnu.warning)
91 *(.gnu.linkonce.t*)
92 *(.glue_7)
93 *(.glue_7t)
94 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
95 } = 0xff
96 /* laddr = ADDR(.text) + SIZEOF(.text); */
97 __text_end = .;
99 .rodata :
100 {
101 *(.rodata)
102 *all.rodata*(*)
103 *(.roda)
104 *(.rodata.*)
105 *(.gnu.linkonce.r*)
106 SORT(CONSTRUCTORS)
107 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
108 } = 0xff
109 /* laddr += SIZEOF(.rodata); */
111 .ctors :
112 {
113 /* gcc uses crtbegin.o to find the start of the constructors, so
114 we make sure it is first. Because this is a wildcard, it
115 doesn't matter if the user does not actually link against
116 crtbegin.o; the linker won't look for a file to match a
117 wildcard. The wildcard also means that it doesn't matter which
118 directory crtbegin.o is in. */
119 KEEP (*crtbegin.o(.ctors))
120 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
121 KEEP (*(SORT(.ctors.*)))
122 KEEP (*(.ctors))
123 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
124 } = 0
125 /* laddr += SIZEOF(.ctors); */
126 laddr = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors);
128 .dtors :
129 {
130 KEEP (*crtbegin.o(.dtors))
131 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
132 KEEP (*(SORT(.dtors.*)))
133 KEEP (*(.dtors))
134 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
135 } = 0
136 /* laddr += SIZEOF(.dtors); */
137 laddr = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors);
139 .eh_frame :
140 {
141 KEEP (*(.eh_frame))
142 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
143 } = 0
144 /* laddr += SIZEOF(.eh_frame); */
146 .gcc_except_table :
147 {
148 *(.gcc_except_table)
149 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
150 } = 0
151 /* laddr += (SIZEOF(.gcc_except_table) + 3) & ~ 3; */
152 /* __iwram_lma = laddr; */
153 __iwram_lma = (ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame) + SIZEOF(.gcc_except_table) + 3) & ~ 3;
155 .iwram __iwram_start : AT (__iwram_lma)
156 {
157 __iwram_start = ABSOLUTE(.) ;
158 *(.iwram)
159 *iwram.*(.text)
160 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
161 } = 0xff
162 /* laddr += SIZEOF(.iwram); */
163 /* __data_lma = laddr; */
164 __data_lma = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame) + SIZEOF(.gcc_except_table) + SIZEOF(.iwram);
166 __iwram_end = . ;
168 .bss ALIGN(4) :
169 {
170 __bss_start = ABSOLUTE(.);
171 __bss_start__ = ABSOLUTE(.);
172 *(.dynbss)
173 *(.gnu.linkonce.b*)
174 *(COMMON)
175 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
176 }
178 __bss_end = . ;
179 __bss_end__ = . ;
181 .data ALIGN(4) : AT (__data_lma)
182 {
183 __data_start = ABSOLUTE(.);
184 *(.data)
185 *(.data.*)
186 *(.gnu.linkonce.d*)
187 CONSTRUCTORS
188 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
189 } = 0xff
190 /* laddr += SIZEOF(.data); */
191 /* __iwram_overlay_lma = laddr; */
192 __iwram_overlay_lma = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame) + SIZEOF(.gcc_except_table) + SIZEOF(.iwram) + SIZEOF(.data);
194 __data_end = .;
195 PROVIDE (edata = .);
196 /* __data_lma = LOADADDR(.data); */
197 __iwram_overlay_start = . ;
199 OVERLAY : NOCROSSREFS AT (__iwram_overlay_lma)
200 {
201 .iwram0 { *(.iwram0) . = ALIGN(4);}
202 .iwram1 { *(.iwram1) . = ALIGN(4);}
203 .iwram2 { *(.iwram2) . = ALIGN(4);}
204 .iwram3 { *(.iwram3) . = ALIGN(4);}
205 .iwram4 { *(.iwram4) . = ALIGN(4);}
206 .iwram5 { *(.iwram5) . = ALIGN(4);}
207 .iwram6 { *(.iwram6) . = ALIGN(4);}
208 .iwram7 { *(.iwram7) . = ALIGN(4);}
209 .iwram8 { *(.iwram8) . = ALIGN(4);}
210 .iwram9 { *(.iwram9) . = ALIGN(4);}
211 } = 0xff
212 /* laddr += (SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9)); */
213 /* __ewram_lma = laddr; */
214 __ewram_lma = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame) + SIZEOF(.gcc_except_table) + SIZEOF(.iwram) + SIZEOF(.data) + SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9);
216 /* __iwram_overlay_lma = LOADADDR (.iwram0); */
217 __iwram_overlay_end = . ;
218 /* _end = . ; */
219 /* __end__ = . ; */
220 /* PROVIDE (end = .); */
221 __iheap_start = . ;
223 /* v1.3 */
224 __ewram_start = DEFINED (__gba_multiboot) ? __ewram_lma : 0x2000000;
226 .ewram __ewram_start : AT (__ewram_lma)
227 {
228 /* __ewram_start = ABSOLUTE(.); */
229 *(.ewram)
230 . = ALIGN(4); /* REQUIRED. LD is flaky without it. */
231 } = 0xff
232 /* laddr += SIZEOF(.ewram); */
233 /* __ewram_overlay_lma = laddr; */
234 __ewram_overlay_lma = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame) + SIZEOF(.gcc_except_table) + SIZEOF(.iwram) + SIZEOF(.data) + SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9) + SIZEOF(.ewram);
236 /* __ewram_lma = LOADADDR(.ewram); */
237 __ewram_end = . ;
238 __ewram_overlay_start = . ;
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 } = 0xff
254 __ewram_overlay_end = . ;
256 __eheap_start = . ;
258 _end = DEFINED (__gba_iwram_heap) ? __iheap_start : .; /* v1.3 */
259 __end__ = _end ; /* v1.3 */
260 PROVIDE (end = _end); /* v1.3 */
262 /* Stabs debugging sections. */
263 .stab 0 : { *(.stab) }
264 .stabstr 0 : { *(.stabstr) }
265 .stab.excl 0 : { *(.stab.excl) }
266 .stab.exclstr 0 : { *(.stab.exclstr) }
267 .stab.index 0 : { *(.stab.index) }
268 .stab.indexstr 0 : { *(.stab.indexstr) }
269 .comment 0 : { *(.comment) }
270 /* DWARF debug sections.
271 Symbols in the DWARF debugging sections are relative to the beginning
272 of the section so we begin them at 0. */
273 /* DWARF 1 */
274 .debug 0 : { *(.debug) }
275 .line 0 : { *(.line) }
276 /* GNU DWARF 1 extensions */
277 .debug_srcinfo 0 : { *(.debug_srcinfo) }
278 .debug_sfnames 0 : { *(.debug_sfnames) }
279 /* DWARF 1.1 and DWARF 2 */
280 .debug_aranges 0 : { *(.debug_aranges) }
281 .debug_pubnames 0 : { *(.debug_pubnames) }
282 /* DWARF 2 */
283 .debug_info 0 : { *(.debug_info) }
284 .debug_abbrev 0 : { *(.debug_abbrev) }
285 .debug_line 0 : { *(.debug_line) }
286 .debug_frame 0 : { *(.debug_frame) }
287 .debug_str 0 : { *(.debug_str) }
288 .debug_loc 0 : { *(.debug_loc) }
289 .debug_macinfo 0 : { *(.debug_macinfo) }
290 /* SGI/MIPS DWARF 2 extensions */
291 .debug_weaknames 0 : { *(.debug_weaknames) }
292 .debug_funcnames 0 : { *(.debug_funcnames) }
293 .debug_typenames 0 : { *(.debug_typenames) }
294 .debug_varnames 0 : { *(.debug_varnames) }
295 .stack 0x80000 : { _stack = .; *(.stack) }
296 /* These must appear regardless of . */
297 }