Pārlūkot izejas kodu

+ support omf group-relative fixups pointing to external symbol (e.g.
'wrt dgroup' references)
- removed debug code from TMZExeOutput.DoRelocationFixup

git-svn-id: trunk@31378 -

nickysn 10 gadi atpakaļ
vecāks
revīzija
fa8841d575
1 mainītis faili ar 8 papildinājumiem un 11 dzēšanām
  1. 8 11
      compiler/ogomf.pas

+ 8 - 11
compiler/ogomf.pas

@@ -45,6 +45,7 @@ interface
 
 
       TOmfRelocation = class(TObjRelocation)
       TOmfRelocation = class(TObjRelocation)
       private
       private
+        FFrameGroup: string;
         FOmfFixup: TOmfSubRecord_FIXUP;
         FOmfFixup: TOmfSubRecord_FIXUP;
         function GetGroupIndex(const groupname: string): Integer;
         function GetGroupIndex(const groupname: string): Integer;
       public
       public
@@ -53,6 +54,7 @@ interface
 
 
         procedure BuildOmfFixup;
         procedure BuildOmfFixup;
 
 
+        property FrameGroup: string read FFrameGroup write FFrameGroup;
         property OmfFixup: TOmfSubRecord_FIXUP read FOmfFixup;
         property OmfFixup: TOmfSubRecord_FIXUP read FOmfFixup;
       end;
       end;
 
 
@@ -1539,13 +1541,13 @@ implementation
                   exit;
                   exit;
                 end;
                 end;
             end;
             end;
+            reloc:=TOmfRelocation.CreateSymbol(Fixup.LocationOffset,sym,RelocType);
+            objsec.ObjRelocations.Add(reloc);
             case Fixup.FrameMethod of
             case Fixup.FrameMethod of
               ffmTarget:
               ffmTarget:
                 {nothing};
                 {nothing};
               ffmGroupIndex:
               ffmGroupIndex:
-                begin
-                  {todo: handle 'wrt dgroup' here}
-                end;
+                reloc.FrameGroup:=TObjSectionGroup(objdata.GroupsList[Fixup.FrameDatum-1]).Name;
               else
               else
                 begin
                 begin
                   InputError('Unsupported frame method '+IntToStr(Ord(Fixup.FrameMethod))+' in external reference to '+sym.Name);
                   InputError('Unsupported frame method '+IntToStr(Ord(Fixup.FrameMethod))+' in external reference to '+sym.Name);
@@ -1557,8 +1559,6 @@ implementation
                 InputError('Unsupported nonzero target displacement '+IntToStr(Fixup.TargetDisplacement)+' in external reference to '+sym.Name);
                 InputError('Unsupported nonzero target displacement '+IntToStr(Fixup.TargetDisplacement)+' in external reference to '+sym.Name);
                 exit;
                 exit;
               end;
               end;
-            reloc:=TOmfRelocation.CreateSymbol(Fixup.LocationOffset,sym,RelocType);
-            objsec.ObjRelocations.Add(reloc);
           end;
           end;
         {todo: convert other fixup types as well }
         {todo: convert other fixup types as well }
 
 
@@ -2062,15 +2062,12 @@ implementation
             if assigned(objreloc.symbol) then
             if assigned(objreloc.symbol) then
               begin
               begin
                 target:=objreloc.symbol.address;
                 target:=objreloc.symbol.address;
-                if assigned(objreloc.symbol.group) then
+                if objreloc.FrameGroup<>'' then
+                  framebase:=TMZExeUnifiedLogicalGroup(ExeUnifiedLogicalGroups.Find(objreloc.FrameGroup)).MemPos
+                else if assigned(objreloc.symbol.group) then
                   framebase:=TMZExeUnifiedLogicalGroup(ExeUnifiedLogicalGroups.Find(objreloc.symbol.group.Name)).MemPos
                   framebase:=TMZExeUnifiedLogicalGroup(ExeUnifiedLogicalGroups.Find(objreloc.symbol.group.Name)).MemPos
                 else
                 else
                   framebase:=TOmfObjSection(objreloc.symbol.objsection).MZExeUnifiedLogicalSegment.MemBasePos;
                   framebase:=TOmfObjSection(objreloc.symbol.objsection).MZExeUnifiedLogicalSegment.MemBasePos;
-                if framebase<>0 then
-                  begin
-                    framebase:=0;
-                    Writeln(objreloc.symbol.name);
-                  end;
                 case objreloc.typ of
                 case objreloc.typ of
                   RELOC_ABSOLUTE:
                   RELOC_ABSOLUTE:
                     fixupamount:=target-framebase;
                     fixupamount:=target-framebase;