Bladeren bron

* preserve original order (as specified in the link script) of omf sections with
the same name. This ensures that the startup code always comes first, which is
important for .com files

git-svn-id: trunk@31377 -

nickysn 10 jaren geleden
bovenliggende
commit
173713ce57
1 gewijzigde bestanden met toevoegingen van 8 en 0 verwijderingen
  1. 8 0
      compiler/ogomf.pas

+ 8 - 0
compiler/ogomf.pas

@@ -67,6 +67,7 @@ interface
         FCombination: TOmfSegmentCombination;
         FCombination: TOmfSegmentCombination;
         FUse: TOmfSegmentUse;
         FUse: TOmfSegmentUse;
         FPrimaryGroup: string;
         FPrimaryGroup: string;
+        FSortOrder: Integer;
         FMZExeUnifiedLogicalSegment: TMZExeUnifiedLogicalSegment;
         FMZExeUnifiedLogicalSegment: TMZExeUnifiedLogicalSegment;
         function GetOmfAlignment: TOmfSegmentAlignment;
         function GetOmfAlignment: TOmfSegmentAlignment;
       public
       public
@@ -78,6 +79,7 @@ interface
         property Combination: TOmfSegmentCombination read FCombination;
         property Combination: TOmfSegmentCombination read FCombination;
         property Use: TOmfSegmentUse read FUse;
         property Use: TOmfSegmentUse read FUse;
         property PrimaryGroup: string read FPrimaryGroup;
         property PrimaryGroup: string read FPrimaryGroup;
+        property SortOrder: Integer read FSortOrder write FSortOrder;
         property MZExeUnifiedLogicalSegment: TMZExeUnifiedLogicalSegment read FMZExeUnifiedLogicalSegment write FMZExeUnifiedLogicalSegment;
         property MZExeUnifiedLogicalSegment: TMZExeUnifiedLogicalSegment read FMZExeUnifiedLogicalSegment write FMZExeUnifiedLogicalSegment;
       end;
       end;
 
 
@@ -2106,10 +2108,16 @@ implementation
         Result:=CompareStr(I1.ClassName,I2.ClassName);
         Result:=CompareStr(I1.ClassName,I2.ClassName);
         if Result=0 then
         if Result=0 then
           Result:=CompareStr(I1.Name,I2.Name);
           Result:=CompareStr(I1.Name,I2.Name);
+        if Result=0 then
+          Result:=I1.SortOrder-I2.SortOrder;
       end;
       end;
 
 
     procedure TMZExeOutput.Order_ObjSectionList(ObjSectionList: TFPObjectList; const aPattern: string);
     procedure TMZExeOutput.Order_ObjSectionList(ObjSectionList: TFPObjectList; const aPattern: string);
+      var
+        i: Integer;
       begin
       begin
+        for i:=0 to ObjSectionList.Count-1 do
+          TOmfObjSection(ObjSectionList[i]).SortOrder:=i;
         ObjSectionList.Sort(@IOmfObjSectionClassNameCompare);
         ObjSectionList.Sort(@IOmfObjSectionClassNameCompare);
       end;
       end;