From 3580c53b05f2fab93e588bae74798bf766a3f858 Mon Sep 17 00:00:00 2001 From: nickysn Date: Sat, 25 Apr 2020 14:09:38 +0000 Subject: [PATCH] + enabled library-based smart linking for the ZX Spectrum target (not fully working yet) git-svn-id: branches/z80@45071 - --- compiler/systems/i_zxspectrum.pas | 2 +- compiler/z80/agsdasz80.pas | 41 ++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/compiler/systems/i_zxspectrum.pas b/compiler/systems/i_zxspectrum.pas index 3f7a0ed314..92a371be85 100644 --- a/compiler/systems/i_zxspectrum.pas +++ b/compiler/systems/i_zxspectrum.pas @@ -34,7 +34,7 @@ unit i_zxspectrum; name : 'ZX Spectrum'; shortname : 'zxspectrum'; flags : [tf_needs_symbol_size,tf_files_case_sensitive, - tf_smartlink_sections]; + tf_smartlink_library]; cpu : cpu_sys_z80; unit_env : ''; extradefines : ''; diff --git a/compiler/z80/agsdasz80.pas b/compiler/z80/agsdasz80.pas index cc35364e90..6e0602f1a8 100644 --- a/compiler/z80/agsdasz80.pas +++ b/compiler/z80/agsdasz80.pas @@ -954,6 +954,45 @@ unit agsdasz80; end; end; end; + ait_cutobject : + begin + if SmartAsm then + begin + { only reset buffer if nothing has changed } + if not writer.ClearIfEmpty then + begin + {if SmartAsm then + begin + WriteSmartExternals; + FreeExternChainList; + end; + WriteGroups;} + writer.AsmClose; + DoAssemble; + writer.AsmCreate(tai_cutobject(hp).place); + {ResetSectionsList; + WriteHeader;} + end; + { avoid empty files } + LastSecType:=sec_none; + //LastSecName:=''; + //LastAlign:=4; + while assigned(hp.next) and (tai(hp.next).typ in [ait_cutobject,ait_section,ait_comment]) do + begin + if tai(hp.next).typ=ait_section then + begin + LastSecType:=tai_section(hp.next).sectype; + {LastSecName:=tai_section(hp.next).name^; + LastAlign:=tai_section(hp.next).secalign;} + end; + hp:=tai(hp.next); + end; + {if LastSecType<>sec_none then + WriteSection(LastSecType,LastSecName,LastAlign);} + writer.MarkEmpty; + //NewObject:=true; + end; + end; ait_marker : if tai_marker(hp).kind=mark_NoLineInfoStart then inc(InlineLevel) @@ -1016,7 +1055,7 @@ unit agsdasz80; idtxt : 'SDCC-SDASZ80'; asmbin : 'sdasz80'; - asmcmd : '-o $OBJ $EXTRAOPT $ASM'; + asmcmd : '-g -o $OBJ $EXTRAOPT $ASM'; supported_targets : [system_Z80_embedded]; flags : [af_needar,af_smartlink_sections]; labelprefix : '.L';