Browse Source

+ added i8086-specific consts RELOC_ABSOLUTE16 and RELOC_RELATIVE16, which are
aliases for RELOC_ABSOLUTE and RELOC_RELATIVE
* use RELOC_ABSOLUTE16 and RELOC_RELATIVE16, instead of RELOC_ABSOLUTE and
RELOC_RELATIVE in the linker-related parts of the OMF support (OMF object
reader and MZ exe output). This will make the code more readable, when 32-bit
relocation support is added to the linker. It will also make easier to reuse
this code for i386, in case we add an i386 target, that uses the OMF object
format.

git-svn-id: trunk@32923 -

nickysn 9 years ago
parent
commit
c8e20dfe74
2 changed files with 26 additions and 20 deletions
  1. 8 2
      compiler/ogbase.pas
  2. 18 18
      compiler/ogomf.pas

+ 8 - 2
compiler/ogbase.pas

@@ -106,10 +106,16 @@ interface
          RELOC_RAW
       );
 
-{$if not defined(x86_64) and not defined(i8086)}
+{$if defined(x86_64)}
+    { no special aliases for x86_64 }
+{$elseif defined(i8086)}
+    const
+      RELOC_ABSOLUTE16 = RELOC_ABSOLUTE;
+      RELOC_RELATIVE16 = RELOC_RELATIVE;
+{$else}
     const
       RELOC_ABSOLUTE32 = RELOC_ABSOLUTE;
-{$endif x86_64}
+{$endif}
 
     const
       { stab types }

+ 18 - 18
compiler/ogomf.pas

@@ -1551,9 +1551,9 @@ implementation
               fltOffset:
                 case Fixup.Mode of
                   fmSegmentRelative:
-                    RelocType:=RELOC_ABSOLUTE;
+                    RelocType:=RELOC_ABSOLUTE16;
                   fmSelfRelative:
-                    RelocType:=RELOC_RELATIVE;
+                    RelocType:=RELOC_RELATIVE16;
                 end;
               fltBase:
                 case Fixup.Mode of
@@ -1602,9 +1602,9 @@ implementation
               fltOffset:
                 case Fixup.Mode of
                   fmSegmentRelative:
-                    RelocType:=RELOC_ABSOLUTE;
+                    RelocType:=RELOC_ABSOLUTE16;
                   fmSelfRelative:
-                    RelocType:=RELOC_RELATIVE;
+                    RelocType:=RELOC_RELATIVE16;
                 end;
               fltBase:
                 case Fixup.Mode of
@@ -1653,9 +1653,9 @@ implementation
               fltOffset:
                 case Fixup.Mode of
                   fmSegmentRelative:
-                    RelocType:=RELOC_ABSOLUTE;
+                    RelocType:=RELOC_ABSOLUTE16;
                   fmSelfRelative:
-                    RelocType:=RELOC_RELATIVE;
+                    RelocType:=RELOC_RELATIVE16;
                 end;
               fltBase:
                 case Fixup.Mode of
@@ -2437,16 +2437,16 @@ implementation
                 else
                   framebase:=TOmfObjSection(objreloc.symbol.objsection).MZExeUnifiedLogicalSegment.MemBasePos;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE,RELOC_SEG,RELOC_FARPTR:
+                  RELOC_ABSOLUTE16,RELOC_SEG,RELOC_FARPTR:
                     fixupamount:=target-framebase;
-                  RELOC_RELATIVE,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
+                  RELOC_RELATIVE16,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-2;
                   else
                     internalerror(2015082402);
                 end;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE,
-                  RELOC_RELATIVE:
+                  RELOC_ABSOLUTE16,
+                  RELOC_RELATIVE16:
                     FixupOffset;
                   RELOC_SEG,
                   RELOC_SEGREL:
@@ -2469,16 +2469,16 @@ implementation
                 else
                   framebase:=TOmfObjSection(objreloc.objsection).MZExeUnifiedLogicalSegment.MemBasePos;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE,RELOC_SEG,RELOC_FARPTR:
+                  RELOC_ABSOLUTE16,RELOC_SEG,RELOC_FARPTR:
                     fixupamount:=target-framebase;
-                  RELOC_RELATIVE,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
+                  RELOC_RELATIVE16,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-2;
                   else
                     internalerror(2015082405);
                 end;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE,
-                  RELOC_RELATIVE:
+                  RELOC_ABSOLUTE16,
+                  RELOC_RELATIVE16:
                     FixupOffset;
                   RELOC_SEG,
                   RELOC_SEGREL:
@@ -2502,16 +2502,16 @@ implementation
                 else
                   framebase:=target_group.MemPos;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE,RELOC_SEG,RELOC_FARPTR:
+                  RELOC_ABSOLUTE16,RELOC_SEG,RELOC_FARPTR:
                     fixupamount:=target-framebase;
-                  RELOC_RELATIVE,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
+                  RELOC_RELATIVE16,RELOC_SEGREL,RELOC_FARPTR_RELATIVEOFFSET:
                     fixupamount:=target-(omfsec.MemPos+objreloc.DataOffset)-2;
                   else
                     internalerror(2015111202);
                 end;
                 case objreloc.typ of
-                  RELOC_ABSOLUTE,
-                  RELOC_RELATIVE:
+                  RELOC_ABSOLUTE16,
+                  RELOC_RELATIVE16:
                     FixupOffset;
                   RELOC_SEG,
                   RELOC_SEGREL: