瀏覽代碼

+ i8086-msdos internal linker: write symbol addresses in segment:offset format in the linker map file

git-svn-id: trunk@31425 -
nickysn 10 年之前
父節點
當前提交
19aab3fd31
共有 2 個文件被更改,包括 25 次插入1 次删除
  1. 1 1
      compiler/ogbase.pas
  2. 24 0
      compiler/ogomf.pas

+ 1 - 1
compiler/ogbase.pas

@@ -193,7 +193,7 @@ interface
        procedure SetAddress(apass:byte;aobjsec:TObjSection;abind:TAsmsymbind;atyp:Tasmsymtype);
        function  ObjData: TObjData;
        { string representation for the linker map file }
-       function  AddressStr(AImageBase: qword): string;
+       function  AddressStr(AImageBase: qword): string;virtual;
      end;
      TObjSymbolClass = class of TObjSymbol;
 

+ 24 - 0
compiler/ogomf.pas

@@ -41,6 +41,14 @@ interface
 
     type
 
+      { TOmfObjSymbol }
+
+      TOmfObjSymbol = class(TObjSymbol)
+      public
+        { string representation for the linker map file }
+        function AddressStr(AImageBase: qword): string;override;
+      end;
+
       { TOmfRelocation }
 
       TOmfRelocation = class(TObjRelocation)
@@ -304,6 +312,21 @@ implementation
        version
        ;
 
+{****************************************************************************
+                                TOmfObjSymbol
+****************************************************************************}
+
+    function TOmfObjSymbol.AddressStr(AImageBase: qword): string;
+      var
+        base: qword;
+      begin
+        if assigned(TOmfObjSection(objsection).MZExeUnifiedLogicalSegment) then
+          base:=TOmfObjSection(objsection).MZExeUnifiedLogicalSegment.MemBasePos
+        else
+          base:=(address shr 4) shl 4;
+        Result:=HexStr(base shr 4,4)+':'+HexStr(address-base,4);
+      end;
+
 {****************************************************************************
                                 TOmfRelocation
 ****************************************************************************}
@@ -524,6 +547,7 @@ implementation
     constructor TOmfObjData.create(const n: string);
       begin
         inherited create(n);
+        CObjSymbol:=TOmfObjSymbol;
         CObjSection:=TOmfObjSection;
       end;