Browse Source

+ added an TNewExeOutput.Order_ObjSectionList override and sort obj sections by
class name first, then by name, then by initial order

git-svn-id: trunk@42551 -

nickysn 6 years ago
parent
commit
d10fb705e4
1 changed files with 22 additions and 0 deletions
  1. 22 0
      compiler/ogomf.pas

+ 22 - 0
compiler/ogomf.pas

@@ -481,6 +481,7 @@ interface
         procedure AddImportLibrariesExtractedFromObjectModules;
         procedure AddImportLibrariesExtractedFromObjectModules;
       protected
       protected
         procedure DoRelocationFixup(objsec:TObjSection);override;
         procedure DoRelocationFixup(objsec:TObjSection);override;
+        procedure Order_ObjSectionList(ObjSectionList : TFPObjectList;const aPattern:string);override;
       public
       public
         constructor create;override;
         constructor create;override;
         destructor destroy;override;
         destructor destroy;override;
@@ -3577,6 +3578,27 @@ cleanup:
         {todo}
         {todo}
       end;
       end;
 
 
+    function INewExeOmfObjSectionClassNameCompare(Item1, Item2: Pointer): Integer;
+      var
+        I1 : TOmfObjSection absolute Item1;
+        I2 : TOmfObjSection absolute Item2;
+      begin
+        Result:=CompareStr(I1.ClassName,I2.ClassName);
+        if Result=0 then
+          Result:=CompareStr(I1.Name,I2.Name);
+        if Result=0 then
+          Result:=I1.SortOrder-I2.SortOrder;
+      end;
+
+    procedure TNewExeOutput.Order_ObjSectionList(ObjSectionList: TFPObjectList;const aPattern: string);
+      var
+        i: Integer;
+      begin
+        for i:=0 to ObjSectionList.Count-1 do
+          TOmfObjSection(ObjSectionList[i]).SortOrder:=i;
+        ObjSectionList.Sort(@INewExeOmfObjSectionClassNameCompare);
+      end;
+
     constructor TNewExeOutput.create;
     constructor TNewExeOutput.create;
       begin
       begin
         inherited create;
         inherited create;