Explorar o código

+ added virtual method to tobjsection for returning a string representation of
the section's base address for the internal linker map file
* implemented it for omf sections to return the address in 'seg:ofs' format

git-svn-id: trunk@31359 -

nickysn %!s(int64=10) %!d(string=hai) anos
pai
achega
9aeb94676c
Modificáronse 3 ficheiros con 15 adicións e 1 borrados
  1. 8 0
      compiler/ogbase.pas
  2. 1 1
      compiler/ogmap.pas
  3. 6 0
      compiler/ogomf.pas

+ 8 - 0
compiler/ogbase.pas

@@ -265,6 +265,8 @@ interface
        procedure addrawReloc(ofs:aword;p:TObjSymbol;RawReloctype:byte);
        procedure ReleaseData;
        function  FullName:string;
+       { string representation for the linker map file }
+       function  MemPosStr(AImageBase: qword): string;virtual;
        property  Data:TDynamicArray read FData;
        property  SecOptions:TObjSectionOptions read FSecOptions write SetSecOptions;
      end;
@@ -1002,6 +1004,12 @@ implementation
       end;
 
 
+    function  TObjSection.MemPosStr(AImageBase: qword): string;
+      begin
+        result:='0x'+HexStr(mempos+AImageBase,sizeof(pint)*2);
+      end;
+
+
 {****************************************************************************
                                 TObjData
 ****************************************************************************}

+ 1 - 1
compiler/ogmap.pas

@@ -182,7 +182,7 @@ implementation
              Add(' '+secname);
              secname:='';
            end;
-         Add(' '+PadSpace(secname,14)+PadSpace(' 0x'+HexStr(p.mempos+FImageBase,sizeof(pint)*2),12)+
+         Add(' '+PadSpace(secname,14)+PadSpace(' '+p.MemPosStr(FImageBase),12)+
              ' '+PadSpaceLeft(sizestr(p.size),9)+' '+p.objdata.name);
        end;
 

+ 6 - 0
compiler/ogomf.pas

@@ -68,6 +68,7 @@ interface
         function GetOmfAlignment: TOmfSegmentAlignment;
       public
         constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);override;
+        function MemPosStr(AImageBase: qword): string;override;
         property ClassName: string read FClassName;
         property OverlayName: string read FOverlayName;
         property OmfAlignment: TOmfSegmentAlignment read GetOmfAlignment;
@@ -419,6 +420,11 @@ implementation
           FPrimaryGroup:='';
       end;
 
+    function TOmfObjSection.MemPosStr(AImageBase: qword): string;
+      begin
+        Result:=HexStr(MemPos shr 4,4)+':'+HexStr(MemPos and $000f,4);
+      end;
+
 {****************************************************************************
                                 TOmfObjData
 ****************************************************************************}