Browse Source

* 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 -
svenbarth 5 years ago
parent
commit
3e29742fd9
5 changed files with 20 additions and 15 deletions
  1. 1 1
      compiler/aasmtai.pas
  2. 1 1
      compiler/assemble.pas
  3. 4 4
      compiler/ogcoff.pas
  4. 5 0
      compiler/systems.pas
  5. 9 9
      compiler/systems/t_win.pas

+ 1 - 1
compiler/aasmtai.pas

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

+ 1 - 1
compiler/assemble.pas

@@ -2086,7 +2086,7 @@ Implementation
                    aitconst_rva_symbol :
                    aitconst_rva_symbol :
                      begin
                      begin
                        { PE32+? }
                        { 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)
                          ObjData.writereloc(Tai_const(hp).symofs,sizeof(longint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_RVA)
                        else
                        else
                          ObjData.writereloc(Tai_const(hp).symofs,sizeof(pint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_RVA);
                          ObjData.writereloc(Tai_const(hp).symofs,sizeof(pint),Objdata.SymbolRef(tai_const(hp).sym),RELOC_RVA);

+ 4 - 4
compiler/ogcoff.pas

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

+ 5 - 0
compiler/systems.pas

@@ -376,6 +376,11 @@ interface
                                    system_riscv32_linux,system_riscv64_linux
                                    system_riscv32_linux,system_riscv64_linux
                                   ]+systems_darwin+systems_amigalike;
                                   ]+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 }
        { all systems that use garbage collection for reference-counted types }
        systems_garbage_collected_managed_types = [
        systems_garbage_collected_managed_types = [
          system_jvm_java32,
          system_jvm_java32,

+ 9 - 9
compiler/systems/t_win.pas

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