Browse Source

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

git-svn-id: trunk@30808 -

nickysn 10 years ago
parent
commit
328a4fa19a
1 changed files with 8 additions and 0 deletions
  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);