* changes in linker script and gcc handling

git-svn-id: trunk@6556 -
This commit is contained in:
Legolas 2007-02-18 23:07:59 +00:00
parent ef45e75993
commit aad1de9055
2 changed files with 250 additions and 236 deletions

View File

@ -75,15 +75,17 @@ Var
s,s1,s2 : TCmdStr; s,s1,s2 : TCmdStr;
prtobj, prtobj,
cprtobj : string[80]; cprtobj : string[80];
linklibc : boolean; linklibc,
linklibgcc : boolean;
found1, found1,
found2 : boolean; found2 : boolean;
begin begin
WriteResponseFile:=False; WriteResponseFile:=False;
linklibc:=(SharedLibFiles.Find('c')<>nil); linklibc:=(SharedLibFiles.Find('c')<>nil);
linklibgcc:=(SharedLibFiles.Find('gcc')<>nil);
prtobj:='prt0'; prtobj:='prt0';
cprtobj:='cprt0'; cprtobj:='cprt0';
if linklibc then if (linklibc or linklibgcc) then
prtobj:=cprtobj; prtobj:=cprtobj;
{ Open link.res file } { Open link.res file }
@ -117,11 +119,15 @@ begin
{ try to add crti and crtbegin if linking to C } { try to add crti and crtbegin if linking to C }
if linklibc then if linklibc then
begin begin
if librarysearchpath.FindFile('crtbegin.o',false,s) then
LinkRes.AddFileName(s);
if librarysearchpath.FindFile('crti.o',false,s) then if librarysearchpath.FindFile('crti.o',false,s) then
LinkRes.AddFileName(s); LinkRes.AddFileName(s);
end; end;
if linklibgcc then
begin
if librarysearchpath.FindFile('crtbegin.o',false,s) then
LinkRes.AddFileName(s);
end;
while not ObjectFiles.Empty do while not ObjectFiles.Empty do
begin begin
@ -158,6 +164,7 @@ begin
{ Write sharedlibraries like -l<lib>, also add the needed dynamic linker { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
here to be sure that it gets linked this is needed for glibc2 systems (PFV) } here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
linklibc:=false; linklibc:=false;
linklibgcc:=false;
while not SharedLibFiles.Empty do while not SharedLibFiles.Empty do
begin begin
S:=SharedLibFiles.GetFirst; S:=SharedLibFiles.GetFirst;
@ -172,14 +179,19 @@ begin
begin begin
LinkRes.Add('-l'+s); LinkRes.Add('-l'+s);
linklibc:=true; linklibc:=true;
linklibgcc:=true;
end; end;
end; end;
{ be sure that libc&libgcc is the last lib } { be sure that libc&libgcc is the last lib }
if linklibgcc then
begin
LinkRes.Add('-lgcc');
end;
if linklibc then if linklibc then
begin begin
LinkRes.Add('-lc'); LinkRes.Add('-lc');
LinkRes.Add('-lgcc');
end; end;
end end
else else
begin begin
@ -192,15 +204,23 @@ begin
end; end;
{ objects which must be at the end } { objects which must be at the end }
if linklibc then if linklibgcc then
begin begin
found1:=librarysearchpath.FindFile('crtend.o',false,s1); found1:=librarysearchpath.FindFile('crtend.o',false,s1);
found2:=librarysearchpath.FindFile('crtn.o',false,s2); if found1 then
if found1 or found2 then
begin begin
LinkRes.Add('INPUT('); LinkRes.Add('INPUT(');
if found1 then if found1 then
LinkRes.AddFileName(s1); LinkRes.AddFileName(s1);
LinkRes.Add(')');
end;
end;
if linklibc then
begin
found2:=librarysearchpath.FindFile('crtn.o',false,s2);
if found2 then
begin
LinkRes.Add('INPUT(');
if found2 then if found2 then
LinkRes.AddFileName(s2); LinkRes.AddFileName(s2);
LinkRes.Add(')'); LinkRes.Add(')');
@ -262,263 +282,260 @@ begin
add(''); add('');
add('MEMORY {'); add('MEMORY {');
add(''); add('');
add('rom : ORIGIN = 0x08000000, LENGTH = 32M'); add(' rom : ORIGIN = 0x08000000, LENGTH = 32M');
add('iwram : ORIGIN = 0x03000000, LENGTH = 32K'); add(' iwram : ORIGIN = 0x03000000, LENGTH = 32K');
add('ewram : ORIGIN = 0x02000000, LENGTH = 256K'); add(' ewram : ORIGIN = 0x02000000, LENGTH = 256K');
add('}'); add('}');
add(''); add('');
add('/*'); add('__text_start = ORIGIN(rom);');
add('__text_start = 0x8000000;'); add('__eheap_end = ORIGIN(ewram) + LENGTH(ewram);');
add('__eheap_end = 0x2040000;'); add('__iwram_start = ORIGIN(iwram);');
add('__iwram_start = 0x3000000;'); add('__iwram_top = ORIGIN(iwram) + LENGTH(iwram);;');
add('__iwram_end = 0x3008000;'); add('__sp_irq = __iwram_top - 0x100;');
add(''); add('__sp_usr = __sp_irq - 0x100;');
add('__sp_irq = __iwram_end - 0x100;'); add('__irq_flags = 0x03007ff8;');
add('__sp_usr = __sp_irq - 0x100;');
add('*/');
add('__text_start = ORIGIN(rom);');
add('/* __eheap_end = ORIGIN(ewram) + 0x40000; */');
add('__eheap_end = ORIGIN(ewram) + LENGTH(ewram);');
add('__iwram_start = ORIGIN(iwram);');
add('/* __iwram_end = ORIGIN(iwram) + 0x8000; */');
add('__iwram_end = ORIGIN(iwram) + LENGTH(iwram); ');
add('__sp_irq = __iwram_end - 0x100;');
add('__sp_usr = __sp_irq - 0x100;');
add('');
add(''); add('');
add('SECTIONS'); add('SECTIONS');
add('{'); add('{');
add('. = __text_start;'); add(' . = __text_start;');
add('.init :'); add(' .init :');
add('{'); add(' {');
add('KEEP (*(.init))'); add(' KEEP (*(.init))');
add('. = ALIGN(4);'); add(' . = ALIGN(4);');
add('} >rom =0xff'); add(' } >rom =0xff');
add(''); add('');
add('.plt :'); add(' .plt :');
add('{'); add(' {');
add('*(.plt)'); add(' *(.plt)');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >rom'); add(' } >rom');
add(''); add('');
add('.text : /* ALIGN (4): */'); add(' .text : /* ALIGN (4): */');
add('{'); add(' {');
add('*(EXCLUDE_FILE (*.iwram*) .text)'); add(' *(EXCLUDE_FILE (*.iwram*) .text)');
add('*(.text.*)'); add(' *(.text.*)');
add('*(.stub)'); add(' *(.stub)');
add('/* .gnu.warning sections are handled specially by elf32.em. */'); add(' /* .gnu.warning sections are handled specially by elf32.em. */');
add('*(.gnu.warning)'); add(' *(.gnu.warning)');
add('*(.gnu.linkonce.t*)'); add(' *(.gnu.linkonce.t*)');
add('*(.glue_7)'); add(' *(.glue_7)');
add('*(.glue_7t)'); add(' *(.glue_7t)');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >rom = 0xff'); add(' } >rom = 0xff');
add(''); add('');
add('__text_end = .;'); add(' __text_end = .;');
add('.fini :'); add(' .fini :');
add('{'); add(' {');
add('KEEP (*(.fini))'); add(' KEEP (*(.fini))');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >rom =0'); add(' } >rom =0');
add(''); add('');
add('.rodata :'); add(' .rodata :');
add('{'); add(' {');
add('*(.rodata)'); add(' *(.rodata)');
add('*all.rodata*(*)'); add(' *all.rodata*(*)');
add('*(.roda)'); add(' *(.roda)');
add('*(.rodata.*)'); add(' *(.rodata.*)');
add('*(.gnu.linkonce.r*)'); add(' *(.gnu.linkonce.r*)');
add('SORT(CONSTRUCTORS)'); add(' SORT(CONSTRUCTORS)');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >rom = 0xff'); add(' } >rom = 0xff');
add(' .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >rom');
add(' __exidx_start = .;');
add(' .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >rom');
add(' __exidx_end = .;');
add(''); add('');
add('.ctors :'); add(' .ctors :');
add('{'); add(' {');
add('/* gcc uses crtbegin.o to find the start of the constructors, so'); add(' /* gcc uses crtbegin.o to find the start of the constructors, so');
add('we make sure it is first. Because this is a wildcard, it'); add(' we make sure it is first. Because this is a wildcard, it');
add('doesn''t matter if the user does not actually link against'); add(' doesn''t matter if the user does not actually link against');
add('crtbegin.o; the linker won''t look for a file to match a'); add(' crtbegin.o; the linker won''t look for a file to match a');
add('wildcard. The wildcard also means that it doesn''t matter which'); add(' wildcard. The wildcard also means that it doesn''t matter which');
add('directory crtbegin.o is in. */'); add(' directory crtbegin.o is in. */');
add('KEEP (*crtbegin.o(.ctors))'); add(' KEEP (*crtbegin.o(.ctors))');
add('KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))'); add(' KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))');
add('KEEP (*(SORT(.ctors.*)))'); add(' KEEP (*(SORT(.ctors.*)))');
add('KEEP (*(.ctors))'); add(' KEEP (*(.ctors))');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >rom = 0'); add(' } >rom = 0');
add(''); add('');
add('.dtors :'); add(' .dtors :');
add('{'); add(' {');
add('KEEP (*crtbegin.o(.dtors))'); add(' KEEP (*crtbegin.o(.dtors))');
add('KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))'); add(' KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))');
add('KEEP (*(SORT(.dtors.*)))'); add(' KEEP (*(SORT(.dtors.*)))');
add('KEEP (*(.dtors))'); add(' KEEP (*(.dtors))');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >rom = 0'); add(' } >rom = 0');
add(''); add('');
add('.jcr : { KEEP (*(.jcr)) } >rom ');
add(''); add('');
add('.eh_frame :'); add(' .eh_frame :');
add('{'); add(' {');
add('KEEP (*(.eh_frame))'); add(' KEEP (*(.eh_frame))');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >rom = 0'); add(' } >rom = 0');
add(''); add('');
add('.gcc_except_table :'); add(' .gcc_except_table :');
add('{'); add(' {');
add('*(.gcc_except_table)'); add(' *(.gcc_except_table)');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >rom = 0'); add(' } >rom = 0');
add(''); add('');
add('__iwram_lma = .;'); add(' __iwram_lma = .;');
add(''); add('');
add('.iwram __iwram_start : AT (__iwram_lma)'); add(' .iwram __iwram_start : AT (__iwram_lma)');
add('{'); add(' {');
add('__iwram_start = ABSOLUTE(.) ;'); add(' __iwram_start = ABSOLUTE(.) ;');
add('*(.iwram)'); add(' *(.iwram)');
add('*iwram.*(.text)'); add(' *iwram.*(.text)');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >iwram = 0xff'); add(' __iwram_end = ABSOLUTE(.) ;');
add(' } >iwram = 0xff');
add(''); add('');
add('__data_lma = __iwram_lma + SIZEOF(.iwram) ;'); add(' __data_lma = __iwram_lma + SIZEOF(.iwram) ;');
add('__iwram_end = . ;');
add(''); add('');
add('.bss ALIGN(4) :'); add(' .bss ALIGN(4) :');
add('{'); add(' {');
add('__bss_start = ABSOLUTE(.);'); add(' __bss_start = ABSOLUTE(.);');
add('__bss_start__ = ABSOLUTE(.);'); add(' __bss_start__ = ABSOLUTE(.);');
add('*(.dynbss)'); add(' *(.dynbss)');
add('*(.gnu.linkonce.b*)'); add(' *(.gnu.linkonce.b*)');
add('*(.bss*)'); add(' *(.bss*)');
add('*(COMMON)'); add(' *(COMMON)');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} >iwram'); add(' __bss_end = ABSOLUTE(.) ;');
add(''); add('');
add('__bss_end = . ;'); add(' } >iwram');
add('__bss_end__ = . ;');
add(''); add('');
add('.data ALIGN(4) : AT (__data_lma)'); add(' __bss_end__ = __bss_end ;');
add('{');
add('__data_start = ABSOLUTE(.);');
add('*(.data)');
add('*(.data.*)');
add('*(.gnu.linkonce.d*)');
add('*(.fpc*)');
add('CONSTRUCTORS');
add('. = ALIGN(4);');
add('} >iwram = 0xff');
add(''); add('');
add('__iwram_overlay_lma = __data_lma + SIZEOF(.data);'); add(' .data ALIGN(4) : AT (__data_lma)');
add(' {');
add(' __data_start = ABSOLUTE(.);');
add(' *(.data)');
add(' *(.data.*)');
add(' *(.gnu.linkonce.d*)');
add(' *(.fpc*)');
add(' CONSTRUCTORS');
add(' . = ALIGN(4);');
add(' } >iwram = 0xff');
add(''); add('');
add('__data_end = .;'); add(' __preinit_lma = __data_lma + SIZEOF(.data);');
add('__iwram_overlay_start = . ;');
add(''); add('');
add('OVERLAY ALIGN(4) : NOCROSSREFS AT (__iwram_overlay_lma)'); add(' PROVIDE (__preinit_array_start = .);');
add('{'); add(' .preinit_array : AT (__preinit_lma) { KEEP (*(.preinit_array)) } >iwram');
add('.iwram0 { *(.iwram0) . = ALIGN(4);}'); add(' PROVIDE (__preinit_array_end = .);');
add('.iwram1 { *(.iwram1) . = ALIGN(4);}');
add('.iwram2 { *(.iwram2) . = ALIGN(4);}');
add('.iwram3 { *(.iwram3) . = ALIGN(4);}');
add('.iwram4 { *(.iwram4) . = ALIGN(4);}');
add('.iwram5 { *(.iwram5) . = ALIGN(4);}');
add('.iwram6 { *(.iwram6) . = ALIGN(4);}');
add('.iwram7 { *(.iwram7) . = ALIGN(4);}');
add('.iwram8 { *(.iwram8) . = ALIGN(4);}');
add('.iwram9 { *(.iwram9) . = ALIGN(4);}');
add('}>iwram = 0xff');
add(''); add('');
add('__ewram_lma = LOADADDR(.iwram0) + SIZEOF(.iwram0)+SIZEOF(.iwram1)+SIZEOF(.iwram2)+SIZEOF(.iwram3)+SIZEOF(.iwram4)+SIZEOF(.iwram5)+SIZEOF(.iwram6)+SIZEOF(.iwram7)+SIZEOF(.iwram8)+SIZEOF(.iwram9);'); add(' __init_lma = __preinit_lma + SIZEOF(.preinit_array);');
add(''); add('');
add('__iwram_overlay_end = . ;'); add(' PROVIDE (__init_array_start = .);');
add('__iheap_start = . ;'); add(' .init_array : AT (__init_lma) { KEEP (*(.init_array)) } >iwram');
add(' PROVIDE (__init_array_end = .);');
add(' PROVIDE (__fini_array_start = .);');
add(''); add('');
add('__ewram_start = 0x2000000;'); add(' __fini_lma = __init_lma + SIZEOF(.init_array);');
add('.ewram __ewram_start : AT (__ewram_lma)');
add('{');
add('*(.ewram)');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('}>ewram = 0xff');
add(''); add('');
add('__ewram_overlay_lma = __ewram_lma + SIZEOF(.ewram);'); add(' .fini_array : AT (__fini_lma) { KEEP (*(.fini_array)) } >iwram');
add(' PROVIDE (__fini_array_end = .);');
add(''); add('');
add('.sbss ALIGN(4):'); add(' __jcr_lma = __fini_lma + SIZEOF(.fini_array);');
add('{'); add(' .jcr : AT (__jcr_lma) { KEEP (*(.jcr)) } >iwram');
add('__sbss_start = ABSOLUTE(.);');
add('*(.sbss)');
add('. = ALIGN(4);');
add('} >ewram');
add(' ');
add('__sbss_end = .;');
add(''); add('');
add('__ewram_end = . ;'); add(' __data_end = ABSOLUTE(.);');
add('__ewram_overlay_start = . ;'); add(' __iwram_overlay_lma = __jcr_lma + SIZEOF(.jcr);');
add(''); add('');
add('OVERLAY ALIGN(4): NOCROSSREFS AT (__ewram_overlay_lma)'); add(' __iwram_overlay_start = . ;');
add('{');
add('.ewram0 { *(.ewram0) . = ALIGN(4);}');
add('.ewram1 { *(.ewram1) . = ALIGN(4);}');
add('.ewram2 { *(.ewram2) . = ALIGN(4);}');
add('.ewram3 { *(.ewram3) . = ALIGN(4);}');
add('.ewram4 { *(.ewram4) . = ALIGN(4);}');
add('.ewram5 { *(.ewram5) . = ALIGN(4);}');
add('.ewram6 { *(.ewram6) . = ALIGN(4);}');
add('.ewram7 { *(.ewram7) . = ALIGN(4);}');
add('.ewram8 { *(.ewram8) . = ALIGN(4);}');
add('.ewram9 { *(.ewram9) . = ALIGN(4);}');
add('}>ewram = 0xff');
add(''); add('');
add('__pad_lma = LOADADDR(.ewram0) + SIZEOF(.ewram0)+SIZEOF(.ewram1)+SIZEOF(.ewram2)+SIZEOF(.ewram3)+SIZEOF(.ewram4)+SIZEOF(.ewram5)+SIZEOF(.ewram6)+SIZEOF(.ewram7)+SIZEOF(.ewram8)+SIZEOF(.ewram9);'); add(' OVERLAY ALIGN(4) : NOCROSSREFS AT (__iwram_overlay_lma)');
add(' {');
add(' .iwram0 { *(.iwram0) . = ALIGN(4);}');
add(' .iwram1 { *(.iwram1) . = ALIGN(4);}');
add(' .iwram2 { *(.iwram2) . = ALIGN(4);}');
add(' .iwram3 { *(.iwram3) . = ALIGN(4);}');
add(' .iwram4 { *(.iwram4) . = ALIGN(4);}');
add(' .iwram5 { *(.iwram5) . = ALIGN(4);}');
add(' .iwram6 { *(.iwram6) . = ALIGN(4);}');
add(' .iwram7 { *(.iwram7) . = ALIGN(4);}');
add(' .iwram8 { *(.iwram8) . = ALIGN(4);}');
add(' .iwram9 { *(.iwram9) . = ALIGN(4);}');
add(' }>iwram = 0xff');
add(''); add('');
add('/* EZF Advance strips trailing 0xff bytes, add a pad section so nothing important is removed */'); add(' __ewram_lma = __load_stop_iwram9;');
add('.pad ALIGN(4) : AT (__pad_lma)');
add('{');
add('LONG(0x52416b64)');
add('LONG(0x4d)');
add('. = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('} = 0xff');
add(''); add('');
add('__ewram_overlay_end = . ;'); add(' __iwram_overlay_end = . ;');
add('__eheap_start = . ;'); add(' __iheap_start = . ;');
add(''); add('');
add('_end = .;'); add(' __ewram_start = ORIGIN(ewram);');
add('__end__ = _end ; /* v1.3 */'); add(' .ewram __ewram_start : AT (__ewram_lma)');
add('PROVIDE (end = _end); /* v1.3 */'); add(' {');
add(' *(.ewram)');
add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add(' }>ewram = 0xff');
add(''); add('');
add('/* Stabs debugging sections. */'); add(' __pad_lma = __ewram_lma + SIZEOF(.ewram);');
add('.stab 0 : { *(.stab) }'); add('');
add('.stabstr 0 : { *(.stabstr) }'); add(' .sbss ALIGN(4):');
add('.stab.excl 0 : { *(.stab.excl) }'); add(' {');
add('.stab.exclstr 0 : { *(.stab.exclstr) }'); add(' __sbss_start = ABSOLUTE(.);');
add('.stab.index 0 : { *(.stab.index) }'); add(' *(.sbss)');
add('.stab.indexstr 0 : { *(.stab.indexstr) }'); add(' . = ALIGN(4);');
add('.comment 0 : { *(.comment) }'); add(' __sbss_end = ABSOLUTE(.);');
add('/* DWARF debug sections.'); add(' } >ewram');
add('Symbols in the DWARF debugging sections are relative to the beginning'); add('');
add('of the section so we begin them at 0. */'); add('');
add('/* DWARF 1 */'); add(' __ewram_end = __sbss_end ;');
add('.debug 0 : { *(.debug) }'); add(' __eheap_start = __sbss_end;');
add('.line 0 : { *(.line) }'); add(' __end__ = __sbss_end;');
add('/* GNU DWARF 1 extensions */'); add(' end = __sbss_end;');
add('.debug_srcinfo 0 : { *(.debug_srcinfo) }'); add('');
add('.debug_sfnames 0 : { *(.debug_sfnames) }'); add(' /* EZF Advance strips trailing 0xff bytes, add a pad section so nothing important is removed */');
add('/* DWARF 1.1 and DWARF 2 */'); add(' .pad ALIGN(4) : AT (__pad_lma)');
add('.debug_aranges 0 : { *(.debug_aranges) }'); add(' {');
add('.debug_pubnames 0 : { *(.debug_pubnames) }'); add(' LONG(0x52416b64)');
add('/* DWARF 2 */'); add(' LONG(0x4d)');
add('.debug_info 0 : { *(.debug_info) }'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add('.debug_abbrev 0 : { *(.debug_abbrev) }'); add(' } = 0xff');
add('.debug_line 0 : { *(.debug_line) }'); add('');
add('.debug_frame 0 : { *(.debug_frame) }'); add('');
add('.debug_str 0 : { *(.debug_str) }'); add(' /* Stabs debugging sections. */');
add('.debug_loc 0 : { *(.debug_loc) }'); add(' .stab 0 : { *(.stab) }');
add('.debug_macinfo 0 : { *(.debug_macinfo) }'); add(' .stabstr 0 : { *(.stabstr) }');
add('/* SGI/MIPS DWARF 2 extensions */'); add(' .stab.excl 0 : { *(.stab.excl) }');
add('.debug_weaknames 0 : { *(.debug_weaknames) }'); add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
add('.debug_funcnames 0 : { *(.debug_funcnames) }'); add(' .stab.index 0 : { *(.stab.index) }');
add('.debug_typenames 0 : { *(.debug_typenames) }'); add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
add('.debug_varnames 0 : { *(.debug_varnames) }'); add(' .comment 0 : { *(.comment) }');
add('.stack 0x80000 : { _stack = .; *(.stack) }'); add(' /* DWARF debug sections.');
add('/* These must appear regardless of . */'); add(' Symbols in the DWARF debugging sections are relative to the beginning');
add(' of the section so we begin them at 0. */');
add(' /* DWARF 1 */');
add(' .debug 0 : { *(.debug) }');
add(' .line 0 : { *(.line) }');
add(' /* GNU DWARF 1 extensions */');
add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
add(' /* DWARF 1.1 and DWARF 2 */');
add(' .debug_aranges 0 : { *(.debug_aranges) }');
add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
add(' /* DWARF 2 */');
add(' .debug_info 0 : { *(.debug_info) }');
add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
add(' .debug_line 0 : { *(.debug_line) }');
add(' .debug_frame 0 : { *(.debug_frame) }');
add(' .debug_str 0 : { *(.debug_str) }');
add(' .debug_loc 0 : { *(.debug_loc) }');
add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
add(' /* SGI/MIPS DWARF 2 extensions */');
add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
add(' .debug_typenames 0 : { *(.debug_typenames) }');
add(' .debug_varnames 0 : { *(.debug_varnames) }');
add(' .stack 0x80000 : { _stack = .; *(.stack) }');
add(' /* These must appear regardless of . */');
add(' .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }');
add(' .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }');
add(' /DISCARD/ : { *(.note.GNU-stack) }');
add('}'); add('}');
end; end;

View File

@ -367,7 +367,7 @@ begin
add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */'); add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add(' } >ewram = 0xff'); add(' } >ewram = 0xff');
add(' .jcr : { KEEP (*(.jcr)) } >ewram = 0'); add(' .jcr : { KEEP (*(.jcr)) } >ewram = 0');
add(' .got : { *(.got.plt) *(.got) } >ewram = 0'); add(' .got : { *(.got.plt) *(.got) *(.rel.got) } >ewram = 0');
add(''); add('');
add(' .ewram ALIGN(4) : '); add(' .ewram ALIGN(4) : ');
add(' {'); add(' {');
@ -490,13 +490,10 @@ begin
add(''); add('');
add('MEMORY {'); add('MEMORY {');
add(''); add('');
add(' rom : ORIGIN = 0x08000000, LENGTH = 32M'); add(' rom : ORIGIN = 0x08000000, LENGTH = 32M');
add(' iwram : ORIGIN = 0x03800000, LENGTH = 64K'); add(' iwram : ORIGIN = 0x037f8000, LENGTH = 96K');
add(' ewram : ORIGIN = 0x02040000, LENGTH = 4M');
add('}'); add('}');
add(''); add('');
add('__ewram_start = ORIGIN(ewram);');
add('__eheap_end = ORIGIN(ewram)+ LENGTH(ewram);');
add('__iwram_start = ORIGIN(iwram);'); add('__iwram_start = ORIGIN(iwram);');
add('__iwram_top = ORIGIN(iwram)+ LENGTH(iwram);'); add('__iwram_top = ORIGIN(iwram)+ LENGTH(iwram);');
add('__sp_irq = __iwram_top - 0x60;'); add('__sp_irq = __iwram_top - 0x60;');