gbasys

diff samples/fonts/lnkscript @ 0:875ef6085efc

gbasys mercurial repository
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 04 Mar 2012 04:04:25 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/fonts/lnkscript	Sun Mar 04 04:04:25 2012 +0200
     1.3 @@ -0,0 +1,297 @@
     1.4 +/* Linker Script v1.3 by Jeff Frohwein              */
     1.5 +/*  v1.0 - Original release                         */
     1.6 +/*  v1.1 - Added proper .data section support       */
     1.7 +/*  v1.2 - Added support for c++ & iwram overlays   */
     1.8 +/*       - Major contributions by Jason Wilkins.    */
     1.9 +/*  v1.3 - .ewram section now can be used when      */
    1.10 +/*         compiling for MULTIBOOT mode. This fixes */
    1.11 +/*         malloc() in DevKitAdvance which depends  */
    1.12 +/*         on __eheap_start instead of end to define*/
    1.13 +/*         the starting location of heap space.     */
    1.14 +/*         External global variable __gba_iwram_heap*/
    1.15 +/*         support added to allow labels end, _end, */
    1.16 +/*         & __end__ to point to end of iwram or    */
    1.17 +/*         the end of ewram.                        */
    1.18 +
    1.19 +/* This file is released into the public domain   */
    1.20 +/* for commercial or non-commercial use with no   */
    1.21 +/* restrictions placed upon it.                   */
    1.22 +
    1.23 +/* NOTE!!!: This linker script defines the RAM &  */
    1.24 +/*   ROM start addresses. In order for it to work */
    1.25 +/*   properly, remove -Ttext and -Tbss linker     */
    1.26 +/*   options from your makefile if they are       */
    1.27 +/*   present.                                     */
    1.28 +
    1.29 +/* You can use the following to view section      */
    1.30 +/* addresses in your .elf file:                   */
    1.31 +/*   objdump -h file.elf                          */
    1.32 +/* Please note that empty sections may incorrectly*/
    1.33 +/* list the lma address as the vma address for    */
    1.34 +/* some versions of objdump.                      */
    1.35 +
    1.36 +OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
    1.37 +OUTPUT_ARCH(arm)
    1.38 +ENTRY(_start)
    1.39 +/* SEARCH_DIR(/bin/arm); */
    1.40 +
    1.41 +/* By default this linker script will generate code        */
    1.42 +/* for flash carts located at 0x8000000. In order to       */
    1.43 +/* generate code that is compiled at 0x2000000 that        */
    1.44 +/* will run on flash carts or in multiboot mode then       */
    1.45 +/* you need to add the following variable to your main     */
    1.46 +/* project file. It's value is NOT important but           */
    1.47 +/* IT MUST BE A GLOBAL VARIABLE OR IT WILL NOT WORK:       */
    1.48 +
    1.49 +/*   #define MULTIBOOT int __gba_multiboot;                */
    1.50 +/* Then use it like this: MULTIBOOT                        */
    1.51 +
    1.52 +/* By default this linker script will set the labels       */
    1.53 +/* end, _end, & __end__ at the end of ewram. To force      */
    1.54 +/* them to be set to the end of iwram then you need to     */
    1.55 +/* add the following variable to your main                 */
    1.56 +/* project file. It's value is NOT important but           */
    1.57 +/* IT MUST BE A GLOBAL VARIABLE OR IT WILL NOT WORK:       */
    1.58 +
    1.59 +/*   #define IWRAMHEAP int __gba_iwram_heap;               */
    1.60 +/* Then use it like this: IWRAMHEAP                        */
    1.61 +
    1.62 +/* The linker script function "var1 += var2;" sometimes    */
    1.63 +/* reports incorrect values in the *.map file but the      */
    1.64 +/* actual value it calculates is usually, if not always,   */
    1.65 +/* correct. If you leave out the ". = ALIGN(4);" at the    */
    1.66 +/* end of each section then the return value of SIZEOF()   */
    1.67 +/* is sometimes incorrect and "var1 += var2;" appears to   */
    1.68 +/* not work as well. "var1 += var2" style functions are    */
    1.69 +/* avoided below as a result.                              */
    1.70 +
    1.71 +/* The linker script MEMORY directive is not used here due    */
    1.72 +/* to the fact that __text_start is not always a fixed value. */
    1.73 +
    1.74 +__text_start = DEFINED (__gba_multiboot) ? 0x2000000 : 0x8000000;
    1.75 +/* __ewram_start     = 0x2000000; */ /* Removed in v1.3 */
    1.76 +__eheap_end       = 0x2040000;
    1.77 +__iwram_start     = 0x3000000;
    1.78 +__iheap_end       = 0x3008000 - 0x400;
    1.79 +__sp_usr          = 0x3008000 - 0x100;
    1.80 +__sp_irq          = 0x3008000 - 0x60;
    1.81 +__intr_vector_buf = 0x3008000 - 4;
    1.82 +__sp_usr_offset   = __sp_usr - __iwram_start;
    1.83 +__intr_vect_offset = __intr_vector_buf - __sp_usr;
    1.84 +
    1.85 +SECTIONS
    1.86 +{
    1.87 +  .text __text_start :   /* ALIGN (4): */
    1.88 +  {
    1.89 +    *(EXCLUDE_FILE (*text.iwram*) .text)
    1.90 +    *(.text.*)
    1.91 +    *(.stub)
    1.92 +    /* .gnu.warning sections are handled specially by elf32.em.  */
    1.93 +    *(.gnu.warning)
    1.94 +    *(.gnu.linkonce.t*)
    1.95 +    *(.glue_7)
    1.96 +    *(.glue_7t)
    1.97 +    . = ALIGN(4);  /* REQUIRED. LD is flaky without it. */
    1.98 +  } = 0xff
    1.99 +/*  laddr = ADDR(.text) + SIZEOF(.text); */
   1.100 +  __text_end = .;
   1.101 +
   1.102 +  .rodata :
   1.103 +  {
   1.104 +    *(.rodata)
   1.105 +    *all.rodata*(*)
   1.106 +    *(.roda)
   1.107 +    *(.rodata.*)
   1.108 +    *(.gnu.linkonce.r*)
   1.109 +    SORT(CONSTRUCTORS)
   1.110 +    . = ALIGN(4);   /* REQUIRED. LD is flaky without it. */
   1.111 +  } = 0xff
   1.112 +/*  laddr += SIZEOF(.rodata); */
   1.113 +
   1.114 +  .ctors :
   1.115 +  {
   1.116 +    /* gcc uses crtbegin.o to find the start of the constructors, so
   1.117 +       we make sure it is first.  Because this is a wildcard, it
   1.118 +       doesn't matter if the user does not actually link against
   1.119 +       crtbegin.o; the linker won't look for a file to match a
   1.120 +       wildcard.  The wildcard also means that it doesn't matter which
   1.121 +       directory crtbegin.o is in.  */
   1.122 +    KEEP (*crtbegin.o(.ctors))
   1.123 +    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
   1.124 +    KEEP (*(SORT(.ctors.*)))
   1.125 +    KEEP (*(.ctors))
   1.126 +    . = ALIGN(4);   /* REQUIRED. LD is flaky without it. */
   1.127 +  } = 0
   1.128 +/*  laddr += SIZEOF(.ctors); */
   1.129 +  laddr = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors);
   1.130 +
   1.131 +  .dtors :
   1.132 +  {
   1.133 +    KEEP (*crtbegin.o(.dtors))
   1.134 +    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
   1.135 +    KEEP (*(SORT(.dtors.*)))
   1.136 +    KEEP (*(.dtors))
   1.137 +    . = ALIGN(4);   /* REQUIRED. LD is flaky without it. */
   1.138 +  } = 0
   1.139 +/*  laddr += SIZEOF(.dtors); */
   1.140 +  laddr = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors);
   1.141 +
   1.142 +  .eh_frame :
   1.143 +  {
   1.144 +    KEEP (*(.eh_frame))
   1.145 +    . = ALIGN(4);   /* REQUIRED. LD is flaky without it. */
   1.146 +  } = 0
   1.147 +/*  laddr += SIZEOF(.eh_frame); */
   1.148 +
   1.149 +  .gcc_except_table :
   1.150 +  {
   1.151 +    *(.gcc_except_table)
   1.152 +    . = ALIGN(4);   /* REQUIRED. LD is flaky without it. */
   1.153 +  } = 0
   1.154 +/*  laddr += (SIZEOF(.gcc_except_table) + 3) & ~ 3; */
   1.155 +/*  __iwram_lma = laddr; */
   1.156 +  __iwram_lma = (ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame) + SIZEOF(.gcc_except_table) + 3) & ~ 3;
   1.157 +
   1.158 +  .iwram __iwram_start : AT (__iwram_lma)
   1.159 +  {
   1.160 +    __iwram_start = ABSOLUTE(.) ;
   1.161 +    *(.iwram)
   1.162 +    *iwram.*(.text)
   1.163 +    . = ALIGN(4);   /* REQUIRED. LD is flaky without it. */
   1.164 +  } = 0xff
   1.165 +/*  laddr += SIZEOF(.iwram); */
   1.166 +/*  __data_lma = laddr; */
   1.167 +  __data_lma = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame) + SIZEOF(.gcc_except_table) + SIZEOF(.iwram);
   1.168 +
   1.169 +  __iwram_end = . ;
   1.170 +
   1.171 +  .bss ALIGN(4) :
   1.172 +  {
   1.173 +   __bss_start = ABSOLUTE(.);
   1.174 +   __bss_start__ = ABSOLUTE(.);
   1.175 +   *(.dynbss)
   1.176 +   *(.gnu.linkonce.b*)
   1.177 +   *(COMMON)
   1.178 +   . = ALIGN(4);    /* REQUIRED. LD is flaky without it. */
   1.179 +  }
   1.180 +
   1.181 +  __bss_end = . ;
   1.182 +  __bss_end__ = . ;
   1.183 +
   1.184 +  .data ALIGN(4) : AT (__data_lma)
   1.185 +  {
   1.186 +    __data_start = ABSOLUTE(.);
   1.187 +    *(.data)
   1.188 +    *(.data.*)
   1.189 +    *(.gnu.linkonce.d*)
   1.190 +    CONSTRUCTORS
   1.191 +    . = ALIGN(4);  /* REQUIRED. LD is flaky without it. */
   1.192 +  } = 0xff
   1.193 +/*  laddr += SIZEOF(.data); */
   1.194 +/*  __iwram_overlay_lma = laddr; */
   1.195 +  __iwram_overlay_lma = ADDR(.text) + SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.ctors) + SIZEOF(.dtors) + SIZEOF(.eh_frame) + SIZEOF(.gcc_except_table) + SIZEOF(.iwram) + SIZEOF(.data);
   1.196 +
   1.197 +  __data_end  =  .;
   1.198 +  PROVIDE (edata = .);
   1.199 +/*  __data_lma = LOADADDR(.data); */
   1.200 +  __iwram_overlay_start = . ;
   1.201 +
   1.202 +  OVERLAY : NOCROSSREFS AT (__iwram_overlay_lma)
   1.203 +  {
   1.204 +     .iwram0 { *(.iwram0) . = ALIGN(4);}
   1.205 +     .iwram1 { *(.iwram1) . = ALIGN(4);}
   1.206 +     .iwram2 { *(.iwram2) . = ALIGN(4);}
   1.207 +     .iwram3 { *(.iwram3) . = ALIGN(4);}
   1.208 +     .iwram4 { *(.iwram4) . = ALIGN(4);}
   1.209 +     .iwram5 { *(.iwram5) . = ALIGN(4);}
   1.210 +     .iwram6 { *(.iwram6) . = ALIGN(4);}
   1.211 +     .iwram7 { *(.iwram7) . = ALIGN(4);}
   1.212 +     .iwram8 { *(.iwram8) . = ALIGN(4);}
   1.213 +     .iwram9 { *(.iwram9) . = ALIGN(4);}
   1.214 +  } = 0xff
   1.215 +/*  laddr += (SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9)); */
   1.216 +/*  __ewram_lma = laddr; */
   1.217 +  __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);
   1.218 +
   1.219 +/*  __iwram_overlay_lma = LOADADDR (.iwram0); */
   1.220 +  __iwram_overlay_end = . ;
   1.221 +/*  _end = . ; */
   1.222 +/*  __end__ = . ; */
   1.223 +/*  PROVIDE (end = .); */
   1.224 +  __iheap_start = . ;
   1.225 +
   1.226 +  /* v1.3 */
   1.227 +  __ewram_start = DEFINED (__gba_multiboot) ? __ewram_lma : 0x2000000;
   1.228 +
   1.229 +  .ewram __ewram_start : AT (__ewram_lma)
   1.230 +  {
   1.231 +/*    __ewram_start = ABSOLUTE(.); */
   1.232 +    *(.ewram)
   1.233 +    . = ALIGN(4);  /* REQUIRED. LD is flaky without it. */
   1.234 +  } = 0xff
   1.235 +/*  laddr += SIZEOF(.ewram); */
   1.236 +/*  __ewram_overlay_lma = laddr; */
   1.237 +  __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);
   1.238 +
   1.239 +/*  __ewram_lma = LOADADDR(.ewram); */
   1.240 +  __ewram_end = . ;
   1.241 +  __ewram_overlay_start = . ;
   1.242 +
   1.243 +  OVERLAY ALIGN(4): NOCROSSREFS AT (__ewram_overlay_lma)
   1.244 +  {
   1.245 +     .ewram0 { *(.ewram0) . = ALIGN(4);}
   1.246 +     .ewram1 { *(.ewram1) . = ALIGN(4);}
   1.247 +     .ewram2 { *(.ewram2) . = ALIGN(4);}
   1.248 +     .ewram3 { *(.ewram3) . = ALIGN(4);}
   1.249 +     .ewram4 { *(.ewram4) . = ALIGN(4);}
   1.250 +     .ewram5 { *(.ewram5) . = ALIGN(4);}
   1.251 +     .ewram6 { *(.ewram6) . = ALIGN(4);}
   1.252 +     .ewram7 { *(.ewram7) . = ALIGN(4);}
   1.253 +     .ewram8 { *(.ewram8) . = ALIGN(4);}
   1.254 +     .ewram9 { *(.ewram9) . = ALIGN(4);}
   1.255 +  } = 0xff
   1.256 +
   1.257 +  __ewram_overlay_end = . ;
   1.258 +
   1.259 +  __eheap_start = . ;
   1.260 +
   1.261 +  _end = DEFINED (__gba_iwram_heap) ? __iheap_start : .; /* v1.3 */
   1.262 +  __end__ = _end ; /* v1.3 */
   1.263 +  PROVIDE (end = _end); /* v1.3 */
   1.264 +
   1.265 +  /* Stabs debugging sections.  */
   1.266 +  .stab 0 : { *(.stab) }
   1.267 +  .stabstr 0 : { *(.stabstr) }
   1.268 +  .stab.excl 0 : { *(.stab.excl) }
   1.269 +  .stab.exclstr 0 : { *(.stab.exclstr) }
   1.270 +  .stab.index 0 : { *(.stab.index) }
   1.271 +  .stab.indexstr 0 : { *(.stab.indexstr) }
   1.272 +  .comment 0 : { *(.comment) }
   1.273 +  /* DWARF debug sections.
   1.274 +     Symbols in the DWARF debugging sections are relative to the beginning
   1.275 +     of the section so we begin them at 0.  */
   1.276 +  /* DWARF 1 */
   1.277 +  .debug          0 : { *(.debug) }
   1.278 +  .line           0 : { *(.line) }
   1.279 +  /* GNU DWARF 1 extensions */
   1.280 +  .debug_srcinfo  0 : { *(.debug_srcinfo) }
   1.281 +  .debug_sfnames  0 : { *(.debug_sfnames) }
   1.282 +  /* DWARF 1.1 and DWARF 2 */
   1.283 +  .debug_aranges  0 : { *(.debug_aranges) }
   1.284 +  .debug_pubnames 0 : { *(.debug_pubnames) }
   1.285 +  /* DWARF 2 */
   1.286 +  .debug_info     0 : { *(.debug_info) }
   1.287 +  .debug_abbrev   0 : { *(.debug_abbrev) }
   1.288 +  .debug_line     0 : { *(.debug_line) }
   1.289 +  .debug_frame    0 : { *(.debug_frame) }
   1.290 +  .debug_str      0 : { *(.debug_str) }
   1.291 +  .debug_loc      0 : { *(.debug_loc) }
   1.292 +  .debug_macinfo  0 : { *(.debug_macinfo) }
   1.293 +  /* SGI/MIPS DWARF 2 extensions */
   1.294 +  .debug_weaknames 0 : { *(.debug_weaknames) }
   1.295 +  .debug_funcnames 0 : { *(.debug_funcnames) }
   1.296 +  .debug_typenames 0 : { *(.debug_typenames) }
   1.297 +  .debug_varnames  0 : { *(.debug_varnames) }
   1.298 +  .stack 0x80000 : { _stack = .; *(.stack) }
   1.299 +  /* These must appear regardless of  .  */
   1.300 +}