瀏覽代碼

* 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 年之前
父節點
當前提交
0a01c0c76f
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      compiler/omfbase.pas

+ 9 - 0
compiler/omfbase.pas

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