Pārlūkot izejas kodu

+ implemented GetCode/Data/BssSize in the i8086-msdos internal linker

git-svn-id: trunk@31351 -
nickysn 10 gadi atpakaļ
vecāks
revīzija
eed7e3aa6b
1 mainītis faili ar 22 papildinājumiem un 6 dzēšanām
  1. 22 6
      compiler/systems/t_msdos.pas

+ 22 - 6
compiler/systems/t_msdos.pas

@@ -74,6 +74,8 @@ implementation
       { TInternalLinkerMsDos }
 
       TInternalLinkerMsDos=class(tinternallinker)
+      private
+        function GetTotalSizeForSegmentClass(aExeOutput: TExeOutput; const SegClass: string): QWord;
       protected
         function GetCodeSize(aExeOutput: TExeOutput): QWord;override;
         function GetDataSize(aExeOutput: TExeOutput): QWord;override;
@@ -397,22 +399,36 @@ end;
                                TInternalLinkerMsDos
 ****************************************************************************}
 
-function TInternalLinkerMsDos.GetCodeSize(aExeOutput: TExeOutput): QWord;
+function TInternalLinkerMsDos.GetTotalSizeForSegmentClass(
+  aExeOutput: TExeOutput; const SegClass: string): QWord;
+var
+  objseclist: TFPObjectList;
+  objsec: TOmfObjSection;
+  i: Integer;
 begin
-  { TODO: implement }
   Result:=0;
+  objseclist:=aExeOutput.FindExeSection('.MZ_flat_content').ObjSectionList;
+  for i:=0 to objseclist.Count-1 do
+    begin
+      objsec:=TOmfObjSection(objseclist[i]);
+      if objsec.ClassName=SegClass then
+        Inc(Result,objsec.Size);
+    end;
+end;
+
+function TInternalLinkerMsDos.GetCodeSize(aExeOutput: TExeOutput): QWord;
+begin
+  Result:=GetTotalSizeForSegmentClass(aExeOutput,'CODE');
 end;
 
 function TInternalLinkerMsDos.GetDataSize(aExeOutput: TExeOutput): QWord;
 begin
-  { TODO: implement }
-  Result:=0;
+  Result:=GetTotalSizeForSegmentClass(aExeOutput,'DATA');
 end;
 
 function TInternalLinkerMsDos.GetBssSize(aExeOutput: TExeOutput): QWord;
 begin
-  { TODO: implement }
-  Result:=0;
+  Result:=GetTotalSizeForSegmentClass(aExeOutput,'BSS');
 end;
 
 procedure TInternalLinkerMsDos.DefaultLinkScript;