Prechádzať zdrojové kódy

* it's rather useless that sectiontype2options is virtual as we can't use a class type, not to mention that the classes doing the overriding are for the internal assemblers/linkers, but we need it also for external
Thus we move the functionality of the overloads to the basemethod and remove the virtual directive; maybe we'll find a better solution in the future...

git-svn-id: trunk@44926 -

svenbarth 5 rokov pred
rodič
commit
61358b1eaa
3 zmenil súbory, kde vykonal 19 pridanie a 26 odobranie
  1. 19 2
      compiler/ogbase.pas
  2. 0 14
      compiler/ogcoff.pas
  3. 0 10
      compiler/ogomf.pas

+ 19 - 2
compiler/ogbase.pas

@@ -404,7 +404,7 @@ interface
        destructor  destroy;override;
        { Sections }
        function  sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;virtual;abstract;
-       class function sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;virtual;
+       class function sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;
        function  sectiontype2align(atype:TAsmSectiontype):longint;virtual;
        class procedure sectiontype2progbitsandflags(atype:TAsmSectiontype;out progbits:TSectionProgbits;out flags:TSectionFlags);virtual;
        function  createsection(atype:TAsmSectionType;const aname:string='';aorder:TAsmSectionOrder=secorder_default):TObjSection;virtual;
@@ -743,7 +743,11 @@ implementation
 
     uses
       SysUtils,
-      globals,verbose,ogmap;
+      globals,verbose,
+{$ifdef OMFOBJSUPPORT}
+      omfbase,
+{$endif OMFOBJSUPPORT}
+      ogmap;
 
 {$ifdef MEMDEBUG}
     var
@@ -1290,7 +1294,20 @@ implementation
           {arm_attribute} [oso_data]
         );
       begin
+        if (aType in [sec_rodata,sec_rodata_norel]) then
+          begin
+            if (target_info.system in systems_all_windows) then
+              aType:=sec_rodata_norel
+            else
+              aType:=sec_data;
+          end;
         result:=secoptions[atype];
+{$ifdef OMFOBJSUPPORT}
+        { in the huge memory model, BSS data is actually written in the regular
+          FAR_DATA segment of the module }
+        if omf_segclass(atype)='FAR_DATA' then
+          Result:=Result+[oso_data,oso_sparse_data];
+{$endif OMFOBJSUPPORT}
       end;
 
 

+ 0 - 14
compiler/ogcoff.pas

@@ -133,7 +133,6 @@ interface
          constructor createcoff(const n:string;awin32:boolean;acObjSection:TObjSectionClass);
          procedure CreateDebugSections;override;
          function  sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
-         class function sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;override;
          procedure writereloc(data:aint;len:aword;p:TObjSymbol;reloctype:TObjRelocationType);override;
        end;
 
@@ -1214,19 +1213,6 @@ const pemagic : array[0..3] of byte = (
       end;
 
 
-    class function TCoffObjData.sectiontype2options(aType:TAsmSectionType): TObjSectionOptions;
-      begin
-        if (aType in [sec_rodata,sec_rodata_norel]) then
-          begin
-            if (target_info.system in systems_all_windows) then
-              aType:=sec_rodata_norel
-            else
-              aType:=sec_data;
-          end;
-        result:=inherited sectiontype2options(aType);
-      end;
-
-
     procedure TCoffObjData.CreateDebugSections;
       begin
         if target_dbg.id=dbg_stabs then

+ 0 - 10
compiler/ogomf.pas

@@ -128,7 +128,6 @@ interface
       public
         constructor create(const n:string);override;
         destructor destroy;override;
-        class function sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;override;
         function sectiontype2align(atype:TAsmSectiontype):longint;override;
         class function sectiontype2class(atype:TAsmSectiontype):string;
         function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
@@ -1070,15 +1069,6 @@ implementation
         inherited destroy;
       end;
 
-    class function TOmfObjData.sectiontype2options(atype: TAsmSectiontype): TObjSectionOptions;
-      begin
-        Result:=inherited sectiontype2options(atype);
-        { in the huge memory model, BSS data is actually written in the regular
-          FAR_DATA segment of the module }
-        if sectiontype2class(atype)='FAR_DATA' then
-          Result:=Result+[oso_data,oso_sparse_data];
-      end;
-
     function TOmfObjData.sectiontype2align(atype: TAsmSectiontype): longint;
       begin
         Result:=omf_sectiontype2align(atype);