Browse Source

* yet another fix for the MZ relocation offsets
+ support RELOC_SEG and RELOC_SEGREL relocations pointing to an object section

git-svn-id: trunk@31412 -

nickysn 10 years ago
parent
commit
fb1be14337
1 changed files with 6 additions and 3 deletions
  1. 6 3
      compiler/ogomf.pas

+ 6 - 3
compiler/ogomf.pas

@@ -2383,7 +2383,7 @@ implementation
             omfsec.Data.seek(objreloc.DataOffset);
             omfsec.Data.write(w,2);
             Header.AddRelocation(omfsec.MZExeUnifiedLogicalSegment.MemBasePos shr 4,
-              omfsec.MemPos+objreloc.DataOffset-(omfsec.MZExeUnifiedLogicalSegment.MemBasePos shr 4));
+              omfsec.MemPos+objreloc.DataOffset-omfsec.MZExeUnifiedLogicalSegment.MemBasePos);
           end;
 
       begin
@@ -2426,9 +2426,9 @@ implementation
                 else
                   framebase:=TOmfObjSection(objreloc.objsection).MZExeUnifiedLogicalSegment.MemBasePos;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE:
+                  RELOC_ABSOLUTE,RELOC_SEG:
                     fixupamount:=target-framebase;
-                  RELOC_RELATIVE:
+                  RELOC_RELATIVE,RELOC_SEGREL:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-2;
                   else
                     internalerror(2015082405);
@@ -2437,6 +2437,9 @@ implementation
                   RELOC_ABSOLUTE,
                   RELOC_RELATIVE:
                     FixupOffset;
+                  RELOC_SEG,
+                  RELOC_SEGREL:
+                    FixupBase;
                   else
                     internalerror(2015082406);
                 end;