浏览代码

+ enabled library-based smart linking for the ZX Spectrum target (not fully working yet)

git-svn-id: branches/z80@45071 -
nickysn 5 年之前
父节点
当前提交
3580c53b05
共有 2 个文件被更改,包括 41 次插入2 次删除
  1. 1 1
      compiler/systems/i_zxspectrum.pas
  2. 40 1
      compiler/z80/agsdasz80.pas

+ 1 - 1
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 : '';

+ 40 - 1
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';