浏览代码

* Pass ExeOutput as argument to TObjSection.fixuprelocs, needed for ELF targets to relocate the complex GOT stuff.
* TExeSection.AddObjSection made virtual.
- TExeSymbol.ExeSection is nowhere used, removed.

git-svn-id: trunk@21626 -

sergei 13 年之前
父节点
当前提交
7cda919547
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 5 5
      compiler/ogbase.pas
  2. 2 2
      compiler/ogcoff.pas

+ 5 - 5
compiler/ogbase.pas

@@ -42,6 +42,7 @@ interface
 
 
       TExeSection = class;
       TExeSection = class;
       TExeSymbol  = class;
       TExeSymbol  = class;
+      TExeOutput  = class;
 
 
       TObjRelocationType = (
       TObjRelocationType = (
          { Relocation to absolute address }
          { Relocation to absolute address }
@@ -215,7 +216,7 @@ interface
        procedure addsymReloc(ofs:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
        procedure addsymReloc(ofs:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
        procedure addsectionReloc(ofs:aword;aobjsec:TObjSection;Reloctype:TObjRelocationType);
        procedure addsectionReloc(ofs:aword;aobjsec:TObjSection;Reloctype:TObjRelocationType);
        procedure AddSymbolDefine(p:TObjSymbol);
        procedure AddSymbolDefine(p:TObjSymbol);
-       procedure FixupRelocs;virtual;
+       procedure FixupRelocs(Exe: TExeOutput);virtual;
        procedure ReleaseData;
        procedure ReleaseData;
        function  FullName:string;
        function  FullName:string;
        property  Data:TDynamicArray read FData;
        property  Data:TDynamicArray read FData;
@@ -350,7 +351,6 @@ interface
 
 
       TExeSymbol = class(TFPHashObject)
       TExeSymbol = class(TFPHashObject)
         ObjSymbol  : TObjSymbol;
         ObjSymbol  : TObjSymbol;
-        ExeSection : TExeSection;
         State      : TSymbolState;
         State      : TSymbolState;
         { Used for vmt references optimization }
         { Used for vmt references optimization }
         VTable     : TExeVTable;
         VTable     : TExeVTable;
@@ -368,7 +368,7 @@ interface
         SecOptions : TObjSectionOptions;
         SecOptions : TObjSectionOptions;
         constructor create(AList:TFPHashObjectList;const AName:string);virtual;
         constructor create(AList:TFPHashObjectList;const AName:string);virtual;
         destructor  destroy;override;
         destructor  destroy;override;
-        procedure AddObjSection(objsec:TObjSection);
+        procedure AddObjSection(objsec:TObjSection);virtual;
         property ObjSectionList:TFPObjectList read FObjSectionList;
         property ObjSectionList:TFPObjectList read FObjSectionList;
         property SecSymIdx:longint read FSecSymIdx write FSecSymIdx;
         property SecSymIdx:longint read FSecSymIdx write FSecSymIdx;
       end;
       end;
@@ -756,7 +756,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TObjSection.FixupRelocs;
+    procedure TObjSection.FixupRelocs(Exe:TExeOutput);
       begin
       begin
       end;
       end;
 
 
@@ -2841,7 +2841,7 @@ implementation
                 objsec:=TObjSection(exesec.ObjSectionlist[j]);
                 objsec:=TObjSection(exesec.ObjSectionlist[j]);
                 if not objsec.Used then
                 if not objsec.Used then
                   internalerror(200603301);
                   internalerror(200603301);
-                objsec.FixupRelocs;
+                objsec.FixupRelocs(Self);
               end;
               end;
           end;
           end;
       end;
       end;

+ 2 - 2
compiler/ogcoff.pas

@@ -110,7 +110,7 @@ interface
          secidx   : longword;
          secidx   : longword;
          constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);override;
          constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);override;
          procedure addsymsizereloc(ofs:aword;p:TObjSymbol;symsize:aword;reloctype:TObjRelocationType);
          procedure addsymsizereloc(ofs:aword;p:TObjSymbol;symsize:aword;reloctype:TObjRelocationType);
-         procedure fixuprelocs;override;
+         procedure fixuprelocs(Exe:TExeOutput);override;
        end;
        end;
 
 
        TDJCoffObjSection = class(TCoffObjSection)
        TDJCoffObjSection = class(TCoffObjSection)
@@ -846,7 +846,7 @@ const pemagic : array[0..3] of byte = (
       end;
       end;
 
 
 
 
-    procedure TCoffObjSection.fixuprelocs;
+    procedure TCoffObjSection.fixuprelocs(Exe:TExeOutput);
       var
       var
         i,zero,address_size : longint;
         i,zero,address_size : longint;
         objreloc : TObjRelocation;
         objreloc : TObjRelocation;