* for PE+ specific checks use a constant in systems.pas instead of an explicit list (easier to extend this way)

git-svn-id: trunk@44912 -
This commit is contained in:
svenbarth 2020-04-21 06:04:10 +00:00
parent 6630f47ab4
commit 3e29742fd9
5 changed files with 20 additions and 15 deletions

View File

@ -2072,7 +2072,7 @@ implementation
result:=8;
aitconst_secrel32_symbol,
aitconst_rva_symbol :
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
result:=sizeof(longint)
else
result:=sizeof(pint);

View File

@ -2086,7 +2086,7 @@ Implementation
aitconst_rva_symbol :
begin
{ PE32+? }
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
ObjData.writereloc(Tai_const(hp).symofs,sizeof(longint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_RVA)
else
ObjData.writereloc(Tai_const(hp).symofs,sizeof(pint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_RVA);

View File

@ -2884,11 +2884,11 @@ const pemagic : array[0..3] of byte = (
begin
{ idata4 }
idata4objsection.writezeros(sizeof(longint));
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
idata4objsection.writezeros(sizeof(longint));
{ idata5 }
idata5objsection.writezeros(sizeof(longint));
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
idata5objsection.writezeros(sizeof(longint));
end;
@ -2915,14 +2915,14 @@ const pemagic : array[0..3] of byte = (
if AOrdNr <= 0 then
begin
objsec.writereloc_internal(idata6objsection,idata6objsection.size,sizeof(longint),RELOC_RVA);
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
objsec.writezeros(sizeof(longint));
end
else
begin
{ import by ordinal }
ordint:=AOrdNr;
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
begin
objsec.write(ordint,sizeof(ordint));
ordint:=$80000000;

View File

@ -376,6 +376,11 @@ interface
system_riscv32_linux,system_riscv64_linux
]+systems_darwin+systems_amigalike;
{ all systems that use the PE+ header in the PE/COFF file
Note: this is here and not in ogcoff, because it's required in other
units as well }
systems_peoptplus = [system_x86_64_win64];
{ all systems that use garbage collection for reference-counted types }
systems_garbage_collected_managed_types = [
system_jvm_java32,

View File

@ -251,12 +251,12 @@ implementation
{ idata4 }
objdata.SetSection(idata4objsection);
objdata.writebytes(emptyint,sizeof(emptyint));
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
objdata.writebytes(emptyint,sizeof(emptyint));
{ idata5 }
objdata.SetSection(idata5objsection);
objdata.writebytes(emptyint,sizeof(emptyint));
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
objdata.writebytes(emptyint,sizeof(emptyint));
{ idata7 }
objdata.SetSection(idata7objsection);
@ -311,14 +311,14 @@ implementation
begin
{ import by name }
objdata.writereloc(0,sizeof(longint),idata6label,RELOC_RVA);
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
objdata.writebytes(emptyint,sizeof(emptyint));
end
else
begin
{ import by ordinal }
ordint:=ordnr;
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
begin
objdata.writebytes(ordint,sizeof(ordint));
ordint:=$80000000;
@ -487,12 +487,12 @@ implementation
if ImportSymbol.Name<>'' then
begin
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(TAsmLabel(ImportLabels[j])));
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0));
end
else
begin
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_64bit(int64($8000000000000000) or ImportSymbol.ordnr))
else
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(longint($80000000) or ImportSymbol.ordnr));
@ -500,7 +500,7 @@ implementation
end;
{ finalize the names ... }
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0));
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0));
{ then the addresses and create also the indirect jump }
@ -573,12 +573,12 @@ implementation
else
current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(ImportSymbol.MangledName,AT_DATA,0,voidpointertype));
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(TAsmLabel(Importlabels[j])));
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0));
end;
{ finalize the addresses }
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0));
if target_info.system=system_x86_64_win64 then
if target_info.system in systems_peoptplus then
current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0));
{ finally the import information }