瀏覽代碼

* changed the TObjSectionOfs type to be longword on i8086
+ introduced the TObjSection.SizeLimit property. This will allow setting
different size limits for different sections (e.g. 32-bit for the dwarf
sections, 16-bit for the regular code and data sections on i8086).

git-svn-id: trunk@39087 -

nickysn 7 年之前
父節點
當前提交
065a7b63d9
共有 1 個文件被更改,包括 15 次插入2 次删除
  1. 15 2
      compiler/ogbase.pas

+ 15 - 2
compiler/ogbase.pas

@@ -196,7 +196,13 @@ interface
        oscs_largest
      );
 
+{$ifdef i8086}
+     { allow 32-bit sections on i8086. Useful for the dwarf debug info, as well
+       as to allow linking 32-bit obj modules. }
+     TObjSectionOfs = LongWord;
+{$else i8086}
      TObjSectionOfs = PUInt;
+{$endif i8086}
 
      TObjSectionGroup = class;
 
@@ -271,6 +277,7 @@ interface
        FSecOptions : TObjSectionOptions;
        FComdatSelection : TObjSectionComdatSelection;
        FCachedFullName : pshortstring;
+       FSizeLimit : TObjSectionOfs;
        procedure SetSecOptions(Aoptions:TObjSectionOptions);
        procedure SectionTooLargeError;
      public
@@ -313,6 +320,7 @@ interface
        function  MemPosStr(AImageBase: qword): string;virtual;
        property  Data:TDynamicArray read FData;
        property  SecOptions:TObjSectionOptions read FSecOptions write SetSecOptions;
+       property  SizeLimit:TObjSectionOfs read FSizeLimit write FSizeLimit;
      end;
      TObjSectionClass = class of TObjSection;
 
@@ -921,6 +929,11 @@ implementation
         Datapos:=0;
         mempos:=0;
         FData:=Nil;
+{$ifdef i8086}
+        FSizeLimit:=high(word);
+{$else i8086}
+        FSizeLimit:=high(TObjSectionOfs);
+{$endif i8086}
         { Setting the secoptions allocates Data if needed }
         secoptions:=Aoptions;
         secalign:=Aalign;
@@ -968,7 +981,7 @@ implementation
             if Size<>Data.size then
               internalerror(200602281);
 {$ifndef cpu64bitalu}
-            if (qword(size)+l)>high(size) then
+            if (qword(size)+l)>SizeLimit then
               SectionTooLargeError;
 {$endif}
             Data.write(d,l);
@@ -1053,7 +1066,7 @@ implementation
     procedure TObjSection.alloc(l:TObjSectionOfs);
       begin
 {$ifndef cpu64bitalu}
-        if (qword(size)+l)>high(size) then
+        if (qword(size)+l)>SizeLimit then
           SectionTooLargeError;
 {$endif}
         if oso_sparse_data in SecOptions then