浏览代码

+ support RELOC_RELATIVE relocations in the omf object writer, by using omf's
"self relative" (instead of "segment relative") fixups. "Hello world" and
fpctris in the small memory model now work (under dosbox, at least) with the
internal object writer.

git-svn-id: trunk@30581 -

nickysn 10 年之前
父节点
当前提交
03e8c3ae05
共有 1 个文件被更改,包括 12 次插入2 次删除
  1. 12 2
      compiler/ogomf.pas

+ 12 - 2
compiler/ogomf.pas

@@ -157,7 +157,12 @@ implementation
             FOmfFixup.LocationType:=fltOffset;
             FOmfFixup.LocationType:=fltOffset;
             FOmfFixup.FrameDeterminedByThread:=False;
             FOmfFixup.FrameDeterminedByThread:=False;
             FOmfFixup.TargetDeterminedByThread:=False;
             FOmfFixup.TargetDeterminedByThread:=False;
-            FOmfFixup.Mode:=fmSegmentRelative;
+            if typ=RELOC_ABSOLUTE then
+              FOmfFixup.Mode:=fmSegmentRelative
+            else if typ=RELOC_RELATIVE then
+              FOmfFixup.Mode:=fmSelfRelative
+            else
+              internalerror(2015041401);
             FOmfFixup.TargetMethod:=ftmSegmentIndexNoDisp;
             FOmfFixup.TargetMethod:=ftmSegmentIndexNoDisp;
             FOmfFixup.TargetDatum:=ObjSection.Index;
             FOmfFixup.TargetDatum:=ObjSection.Index;
             if TOmfObjSection(ObjSection).PrimaryGroup<>'' then
             if TOmfObjSection(ObjSection).PrimaryGroup<>'' then
@@ -174,7 +179,12 @@ implementation
             FOmfFixup.LocationType:=fltOffset;
             FOmfFixup.LocationType:=fltOffset;
             FOmfFixup.FrameDeterminedByThread:=False;
             FOmfFixup.FrameDeterminedByThread:=False;
             FOmfFixup.TargetDeterminedByThread:=False;
             FOmfFixup.TargetDeterminedByThread:=False;
-            FOmfFixup.Mode:=fmSegmentRelative;
+            if typ=RELOC_ABSOLUTE then
+              FOmfFixup.Mode:=fmSegmentRelative
+            else if typ=RELOC_RELATIVE then
+              FOmfFixup.Mode:=fmSelfRelative
+            else
+              internalerror(2015041401);
             FOmfFixup.TargetMethod:=ftmExternalIndexNoDisp;
             FOmfFixup.TargetMethod:=ftmExternalIndexNoDisp;
             FOmfFixup.TargetDatum:=symbol.symidx;
             FOmfFixup.TargetDatum:=symbol.symidx;
             FOmfFixup.FrameMethod:=ffmTarget;
             FOmfFixup.FrameMethod:=ffmTarget;