Jelajahi Sumber

+ support 48-bit (16:32) far pointer relocations in the OMF internal linker

git-svn-id: trunk@32928 -
nickysn 9 tahun lalu
induk
melakukan
e628729e1d
2 mengubah file dengan 47 tambahan dan 6 penghapusan
  1. 2 0
      compiler/ogbase.pas
  2. 45 6
      compiler/ogomf.pas

+ 2 - 0
compiler/ogbase.pas

@@ -71,6 +71,8 @@ interface
          RELOC_RELATIVE32,
          RELOC_FARPTR,
          RELOC_FARPTR_RELATIVEOFFSET,
+         RELOC_FARPTR48,
+         RELOC_FARPTR48_RELATIVEOFFSET,
          RELOC_SEG,
          RELOC_SEGREL,
          RELOC_DGROUP,

+ 45 - 6
compiler/ogomf.pas

@@ -1576,6 +1576,13 @@ implementation
                   fmSelfRelative:
                     RelocType:=RELOC_FARPTR_RELATIVEOFFSET;
                 end;
+              fltFarPointer48:
+                case Fixup.Mode of
+                  fmSegmentRelative:
+                    RelocType:=RELOC_FARPTR48;
+                  fmSelfRelative:
+                    RelocType:=RELOC_FARPTR48_RELATIVEOFFSET;
+                end;
             end;
             if RelocType=RELOC_NONE then
               begin
@@ -1634,6 +1641,13 @@ implementation
                   fmSelfRelative:
                     RelocType:=RELOC_FARPTR_RELATIVEOFFSET;
                 end;
+              fltFarPointer48:
+                case Fixup.Mode of
+                  fmSegmentRelative:
+                    RelocType:=RELOC_FARPTR48;
+                  fmSelfRelative:
+                    RelocType:=RELOC_FARPTR48_RELATIVEOFFSET;
+                end;
             end;
             if RelocType=RELOC_NONE then
               begin
@@ -1692,6 +1706,13 @@ implementation
                   fmSelfRelative:
                     RelocType:=RELOC_FARPTR_RELATIVEOFFSET;
                 end;
+              fltFarPointer48:
+                case Fixup.Mode of
+                  fmSegmentRelative:
+                    RelocType:=RELOC_FARPTR48;
+                  fmSelfRelative:
+                    RelocType:=RELOC_FARPTR48_RELATIVEOFFSET;
+                end;
             end;
             if RelocType=RELOC_NONE then
               begin
@@ -2471,11 +2492,11 @@ implementation
                 else
                   framebase:=TOmfObjSection(objreloc.symbol.objsection).MZExeUnifiedLogicalSegment.MemBasePos;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG,RELOC_FARPTR:
+                  RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG,RELOC_FARPTR,RELOC_FARPTR48:
                     fixupamount:=target-framebase;
                   RELOC_RELATIVE16,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-2;
-                  RELOC_RELATIVE32:
+                  RELOC_RELATIVE32,RELOC_FARPTR48_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-4;
                   else
                     internalerror(2015082402);
@@ -2496,6 +2517,12 @@ implementation
                       FixupOffset;
                       FixupBase(objreloc.DataOffset+2);
                     end;
+                  RELOC_FARPTR48,
+                  RELOC_FARPTR48_RELATIVEOFFSET:
+                    begin
+                      FixupOffset32;
+                      FixupBase(objreloc.DataOffset+4);
+                    end;
                   else
                     internalerror(2015082403);
                 end;
@@ -2508,11 +2535,11 @@ implementation
                 else
                   framebase:=TOmfObjSection(objreloc.objsection).MZExeUnifiedLogicalSegment.MemBasePos;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG,RELOC_FARPTR:
+                  RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG,RELOC_FARPTR,RELOC_FARPTR48:
                     fixupamount:=target-framebase;
                   RELOC_RELATIVE16,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-2;
-                  RELOC_RELATIVE32:
+                  RELOC_RELATIVE32,RELOC_FARPTR48_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-4;
                   else
                     internalerror(2015082405);
@@ -2533,6 +2560,12 @@ implementation
                       FixupOffset;
                       FixupBase(objreloc.DataOffset+2);
                     end;
+                  RELOC_FARPTR48,
+                  RELOC_FARPTR48_RELATIVEOFFSET:
+                    begin
+                      FixupOffset32;
+                      FixupBase(objreloc.DataOffset+4);
+                    end;
                   else
                     internalerror(2015082406);
                 end;
@@ -2546,11 +2579,11 @@ implementation
                 else
                   framebase:=target_group.MemPos;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG,RELOC_FARPTR:
+                  RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG,RELOC_FARPTR,RELOC_FARPTR48:
                     fixupamount:=target-framebase;
                   RELOC_RELATIVE16,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-2;
-                  RELOC_RELATIVE32:
+                  RELOC_RELATIVE32,RELOC_FARPTR48_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-4;
                   else
                     internalerror(2015111202);
@@ -2571,6 +2604,12 @@ implementation
                       FixupOffset;
                       FixupBase(objreloc.DataOffset+2);
                     end;
+                  RELOC_FARPTR48,
+                  RELOC_FARPTR48_RELATIVEOFFSET:
+                    begin
+                      FixupOffset32;
+                      FixupBase(objreloc.DataOffset+4);
+                    end;
                   else
                     internalerror(2015111203);
                 end;