Kaynağa Gözat

* autoswitch to writing 32-bit PUBDEF OMF records if there's a need to encode a
32-bit offset

git-svn-id: trunk@39089 -

nickysn 7 yıl önce
ebeveyn
işleme
a656d98657
1 değiştirilmiş dosya ile 19 ekleme ve 0 silme
  1. 19 0
      compiler/omfbase.pas

+ 19 - 0
compiler/omfbase.pas

@@ -410,6 +410,8 @@ interface
       procedure DecodeFrom(RawRecord: TOmfRawRecord);override;
       procedure EncodeTo(RawRecord: TOmfRawRecord);override;
 
+      procedure MaybeGo32;
+
       property Is32Bit: Boolean read FIs32Bit write FIs32Bit;
       property BaseGroupIndex: Integer read FBaseGroupIndex write FBaseGroupIndex;
       property BaseSegmentIndex: Integer read FBaseSegmentIndex write FBaseSegmentIndex;
@@ -1718,6 +1720,7 @@ implementation
       Len,LastIncludedIndex,NextOfs,I: Integer;
       PubName: TOmfPublicNameElement;
     begin
+      MaybeGo32;
       if Is32Bit then
         RawRecord.RecordType:=RT_PUBDEF32
       else
@@ -1770,6 +1773,22 @@ implementation
       NextIndex:=LastIncludedIndex+1;
     end;
 
+  procedure TOmfRecord_PUBDEF.MaybeGo32;
+    var
+      I: Integer;
+      PubName: TOmfPublicNameElement;
+    begin
+      for I:=0 to PublicNames.Count-1 do
+        begin
+          PubName:=TOmfPublicNameElement(PublicNames[I]);
+          if PubName.PublicOffset>$ffff then
+            begin
+              Is32Bit:=true;
+              exit;
+            end;
+        end;
+    end;
+
   { TOmfExternalNameElement }
 
   function TOmfExternalNameElement.GetLengthInFile: Integer;