Browse Source

* set MemPos to 0 for each debug .MZ section. This fixes all references within
the debug sections themselves.

git-svn-id: trunk@39235 -

nickysn 7 years ago
parent
commit
3aff9d6735
1 changed files with 14 additions and 0 deletions
  1. 14 0
      compiler/ogomf.pas

+ 14 - 0
compiler/ogomf.pas

@@ -307,6 +307,7 @@ interface
         procedure Load_Symbol(const aname:string);override;
         procedure DoRelocationFixup(objsec:TObjSection);override;
         procedure Order_ObjSectionList(ObjSectionList : TFPObjectList;const aPattern:string);override;
+        procedure MemPos_ExeSection(const aname:string);override;
         procedure MemPos_EndExeSection;override;
         function writeData:boolean;override;
       public
@@ -3060,6 +3061,19 @@ cleanup:
         ObjSectionList.Sort(@IOmfObjSectionClassNameCompare);
       end;
 
+    procedure TMZExeOutput.MemPos_ExeSection(const aname: string);
+      begin
+        { overlay all .exe sections on top of each other. In practice, the MZ
+          formats doesn't have sections, so really, everything goes to a single
+          section, called .MZ_flat_content. All the remaining sections, that we
+          use are the debug sections, which go to a separate ELF file, appended
+          after the end of the .exe. They live in a separate address space, with
+          each section starting at virtual offset 0. So, that's why we always
+          set CurrMemPos to 0 before each section here. }
+        CurrMemPos:=0;
+        inherited MemPos_ExeSection(aname);
+      end;
+
     procedure TMZExeOutput.MemPos_EndExeSection;
       var
         SecName: TSymStr='';