Explorar o código

+ optimization: don't emit relative relocation entries to the same section in
the omf obj writer

git-svn-id: trunk@30808 -

nickysn %!s(int64=10) %!d(string=hai) anos
pai
achega
328a4fa19a
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      compiler/ogomf.pas

+ 8 - 0
compiler/ogomf.pas

@@ -472,6 +472,14 @@ implementation
                 objreloc:=TOmfRelocation.CreateSymbol(CurrObjSec.Size,p,Reloctype);
                 CurrObjSec.ObjRelocations.Add(objreloc);
               end
+            { relative relocations within the same section can be calculated directly,
+              without the need to emit a relocation entry }
+            else if (p.objsection=CurrObjSec) and
+                    (p.bind<>AB_COMMON) and
+                    (Reloctype=RELOC_RELATIVE) then
+              begin
+                data:=data+symaddr-len-CurrObjSec.Size;
+              end
             else
               begin
                 objreloc:=TOmfRelocation.CreateSection(CurrObjSec.Size,p.objsection,Reloctype);