Pārlūkot izejas kodu

* autoswitch to writing 32-bit SEGDEF OMF records if there's a need to encode a
32-bit segment length

git-svn-id: trunk@39095 -

nickysn 7 gadi atpakaļ
vecāks
revīzija
0a01c0c76f
1 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 9 0
      compiler/omfbase.pas

+ 9 - 0
compiler/omfbase.pas

@@ -354,6 +354,8 @@ interface
       procedure DecodeFrom(RawRecord: TOmfRawRecord);override;
       procedure DecodeFrom(RawRecord: TOmfRawRecord);override;
       procedure EncodeTo(RawRecord: TOmfRawRecord);override;
       procedure EncodeTo(RawRecord: TOmfRawRecord);override;
 
 
+      procedure MaybeGo32;
+
       property Alignment: TOmfSegmentAlignment read FAlignment write FAlignment;
       property Alignment: TOmfSegmentAlignment read FAlignment write FAlignment;
       property Combination: TOmfSegmentCombination read FCombination write FCombination;
       property Combination: TOmfSegmentCombination read FCombination write FCombination;
       property Use: TOmfSegmentUse read FUse write FUse;
       property Use: TOmfSegmentUse read FUse write FUse;
@@ -1568,6 +1570,7 @@ implementation
       Big: Boolean;
       Big: Boolean;
       NextOfs: Integer;
       NextOfs: Integer;
     begin
     begin
+      MaybeGo32;
       if Is32Bit then
       if Is32Bit then
         begin
         begin
           RawRecord.RecordType:=RT_SEGDEF32;
           RawRecord.RecordType:=RT_SEGDEF32;
@@ -1612,6 +1615,12 @@ implementation
       RawRecord.CalculateChecksumByte;
       RawRecord.CalculateChecksumByte;
     end;
     end;
 
 
+  procedure TOmfRecord_SEGDEF.MaybeGo32;
+    begin
+      if SegmentLength>65536 then
+        Is32Bit:=true;
+    end;
+
   { TOmfRecord_GRPDEF }
   { TOmfRecord_GRPDEF }
 
 
   procedure TOmfRecord_GRPDEF.DecodeFrom(RawRecord: TOmfRawRecord);
   procedure TOmfRecord_GRPDEF.DecodeFrom(RawRecord: TOmfRawRecord);