Răsfoiți Sursa

+ ogelf.pas: support relocation of type R_X86_64_32 which is apparently used by DWARF3 debug info.

git-svn-id: trunk@19258 -
sergei 14 ani în urmă
părinte
comite
6ee77d9088
1 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 9 1
      compiler/ogelf.pas

+ 9 - 1
compiler/ogelf.pas

@@ -753,13 +753,17 @@ implementation
         if CurrObjSec.sectype in [sec_rodata,sec_bss,sec_threadvar] then
         if CurrObjSec.sectype in [sec_rodata,sec_bss,sec_threadvar] then
           internalerror(200408252);
           internalerror(200408252);
 {$endif userodata}
 {$endif userodata}
+        { Using RELOC_RVA to map 32-bit RELOC_ABSOLUTE to R_X86_64_32
+          (RELOC_ABSOLUTE maps to R_X86_64_32S) }
+        if (reltype=RELOC_ABSOLUTE) and (len<>sizeof(pint)) then
+          reltype:=RELOC_RVA;
         if assigned(p) then
         if assigned(p) then
          begin
          begin
            { real address of the symbol }
            { real address of the symbol }
            symaddr:=p.address;
            symaddr:=p.address;
            { Local ObjSymbols can be resolved already or need a section reloc }
            { Local ObjSymbols can be resolved already or need a section reloc }
            if (p.bind=AB_LOCAL) and
            if (p.bind=AB_LOCAL) and
-              (reltype in [RELOC_RELATIVE,RELOC_ABSOLUTE{$ifdef x86_64},RELOC_ABSOLUTE32{$endif x86_64}]) then
+              (reltype in [RELOC_RELATIVE,RELOC_ABSOLUTE{$ifdef x86_64},RELOC_ABSOLUTE32,RELOC_RVA{$endif x86_64}]) then
              begin
              begin
                { For a reltype relocation in the same section the
                { For a reltype relocation in the same section the
                  value can be calculated }
                  value can be calculated }
@@ -810,8 +814,10 @@ implementation
         relsym,
         relsym,
         reltyp   : longint;
         reltyp   : longint;
         relocsect : TObjSection;
         relocsect : TObjSection;
+{$ifdef x86_64}	
         tmp: aint;
         tmp: aint;
         asize: longint;
         asize: longint;
+{$endif x86_64}	
       begin
       begin
         with elf32data do
         with elf32data do
          begin
          begin
@@ -869,6 +875,8 @@ implementation
                    reltyp:=R_X86_64_64;
                    reltyp:=R_X86_64_64;
                  RELOC_ABSOLUTE32 :
                  RELOC_ABSOLUTE32 :
                    reltyp:=R_X86_64_32S;
                    reltyp:=R_X86_64_32S;
+                 RELOC_RVA :
+                   reltyp:=R_X86_64_32;
                  RELOC_GOTPCREL :
                  RELOC_GOTPCREL :
                    begin
                    begin
                      reltyp:=R_X86_64_GOTPCREL;
                      reltyp:=R_X86_64_GOTPCREL;