فهرست منبع

TImportLibWin.generateimportlib method:
local procedure AddImport: Use same RIP relative code
as in ogcoff unit for x86_64 CPU to allow a VMA above
0x100000000 even when using.
TImportLibWin.generateidatasection;
also used RIP base for import libraries created using -WI option.

git-svn-id: trunk@19161 -

pierre 14 سال پیش
والد
کامیت
841b3e4179
1فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 10 2
      compiler/systems/t_win.pas

+ 10 - 2
compiler/systems/t_win.pas

@@ -263,8 +263,8 @@ implementation
         procedure AddImport(const afuncname,mangledname:string;ordnr:longint;isvar:boolean);
         const
 {$ifdef x86_64}
-          jmpopcode : array[0..2] of byte = (
-            $ff,$24,$25
+          jmpopcode : array[0..1] of byte = (
+            $ff,$25             // jmp qword [rip + offset32]
           );
 {$else x86_64}
   {$ifdef arm}
@@ -367,7 +367,11 @@ implementation
               else
                 implabel:=objdata.SymbolDefine(basedllname+'_index_'+tostr(ordnr),AB_GLOBAL,AT_FUNCTION);
               objdata.writebytes(jmpopcode,sizeof(jmpopcode));
+{$ifdef x86_64}
+              objdata.writereloc(0,sizeof(longint),idata5label,RELOC_RELATIVE);
+{$else}
               objdata.writereloc(0,sizeof(longint),idata5label,RELOC_ABSOLUTE32);
+{$endif x86_64}
               objdata.writebytes(nopopcodes,align(objdata.CurrObjSec.size,sizeof(nopopcodes))-objdata.CurrObjSec.size);
             end;
           ObjOutput.exportsymbol(implabel);
@@ -519,6 +523,10 @@ implementation
                     current_asmdata.asmlists[al_imports].concat(tai_const.create_sym_offset(href.symbol,href.offset));
                   {$else ARM}
                     reference_reset_symbol(href,l4,0,sizeof(pint));
+{$ifdef X86_64}
+                    href.base:=NR_RIP;
+{$endif X86_64}
+
                     current_asmdata.asmlists[al_imports].concat(Taicpu.Op_ref(A_JMP,S_NO,href));
                     current_asmdata.asmlists[al_imports].concat(Tai_align.Create_op(4,$90));
                   {$endif ARM}