Browse Source

* enable some features for the x86_64 UEFI target, based on the win64 target.

git-svn-id: branches/olivier/uefi@36368 -
olivier 8 years ago
parent
commit
0608468c98

+ 1 - 1
compiler/aasmtai.pas

@@ -1906,7 +1906,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 [system_x86_64_win64,system_x86_64_uefi] then
               result:=sizeof(longint)
               result:=sizeof(longint)
             else
             else
               result:=sizeof(pint);
               result:=sizeof(pint);

+ 1 - 1
compiler/assemble.pas

@@ -1899,7 +1899,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 [system_x86_64_win64,system_x86_64_uefi] 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);

+ 2 - 2
compiler/entfile.pas

@@ -872,7 +872,7 @@ var
   d : entryreal;
   d : entryreal;
   hd : double;
   hd : double;
 begin
 begin
-  if target_info.system=system_x86_64_win64 then
+  if target_info.system in [system_x86_64_win64,system_x86_64_uefi] then
     begin
     begin
       hd:=getrealsize(sizeof(hd));
       hd:=getrealsize(sizeof(hd));
       getreal:=hd;
       getreal:=hd;
@@ -1178,7 +1178,7 @@ procedure tentryfile.putreal(d:entryreal);
 var
 var
   hd : double;
   hd : double;
 begin
 begin
-  if target_info.system=system_x86_64_win64 then
+  if target_info.system in [system_x86_64_win64,system_x86_64_uefi] then
     begin
     begin
       hd:=d;
       hd:=d;
       putdata(hd,sizeof(hd));
       putdata(hd,sizeof(hd));

+ 9 - 9
compiler/ogcoff.pas

@@ -2184,7 +2184,7 @@ const pemagic : array[0..3] of byte = (
       begin
       begin
         inherited create;
         inherited create;
         win32:=awin32;
         win32:=awin32;
-        if target_info.system in [system_x86_64_win64] then
+        if target_info.system in [system_x86_64_win64,system_x86_64_uefi] then
           MaxMemPos:=$FFFFFFFF
           MaxMemPos:=$FFFFFFFF
         else
         else
           if target_info.system in systems_wince then
           if target_info.system in systems_wince then
@@ -2522,7 +2522,7 @@ const pemagic : array[0..3] of byte = (
         if win32 then
         if win32 then
           begin
           begin
             header.flag:=PE_FILE_EXECUTABLE_IMAGE or PE_FILE_LINE_NUMS_STRIPPED;
             header.flag:=PE_FILE_EXECUTABLE_IMAGE or PE_FILE_LINE_NUMS_STRIPPED;
-            if target_info.system in [system_x86_64_win64] then
+            if target_info.system in [system_x86_64_win64,system_x86_64_uefi] then
               header.flag:=header.flag or PE_FILE_LARGE_ADDRESS_AWARE
               header.flag:=header.flag or PE_FILE_LARGE_ADDRESS_AWARE
             else
             else
               header.flag:=header.flag or PE_FILE_32BIT_MACHINE;
               header.flag:=header.flag or PE_FILE_32BIT_MACHINE;
@@ -2717,7 +2717,7 @@ const pemagic : array[0..3] of byte = (
         objreloc:TObjRelocation;
         objreloc:TObjRelocation;
         i,j:longint;
         i,j:longint;
       begin
       begin
-        if target_info.system<>system_x86_64_win64 then
+        if not (target_info.system in [system_x86_64_win64,system_x86_64_uefi]) then
           exit;
           exit;
         exesec:=FindExeSection('.pdata');
         exesec:=FindExeSection('.pdata');
         if exesec=nil then
         if exesec=nil then
@@ -2778,11 +2778,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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] then
             idata5objsection.writezeros(sizeof(longint));
             idata5objsection.writezeros(sizeof(longint));
         end;
         end;
 
 
@@ -2809,14 +2809,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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] then
                   begin
                   begin
                     objsec.write(ordint,sizeof(ordint));
                     objsec.write(ordint,sizeof(ordint));
                     ordint:=$80000000;
                     ordint:=$80000000;
@@ -3117,14 +3117,14 @@ const pemagic : array[0..3] of byte = (
         result:=false;
         result:=false;
         fillchar(sechdr,sizeof(sechdr),0);
         fillchar(sechdr,sizeof(sechdr),0);
 {$ifdef win32}
 {$ifdef win32}
-        if (target_info.system=system_x86_64_win64) and
+        if (target_info.system in [system_x86_64_win64,system_x86_64_uefi]) and
           assigned(Wow64DisableWow64FsRedirection) then
           assigned(Wow64DisableWow64FsRedirection) then
           Wow64DisableWow64FsRedirection(p);
           Wow64DisableWow64FsRedirection(p);
 {$endif win32}
 {$endif win32}
         DLLReader:=TObjectReader.Create;
         DLLReader:=TObjectReader.Create;
         DLLReader.OpenFile(dllname);
         DLLReader.OpenFile(dllname);
 {$ifdef win32}
 {$ifdef win32}
-        if (target_info.system=system_x86_64_win64) and
+        if (target_info.system in [system_x86_64_win64,system_x86_64_uefi]) and
           assigned(Wow64RevertWow64FsRedirection) then
           assigned(Wow64RevertWow64FsRedirection) then
           Wow64RevertWow64FsRedirection(p);
           Wow64RevertWow64FsRedirection(p);
 {$endif win32}
 {$endif win32}

+ 8 - 8
compiler/systems/i_uefi.pas

@@ -38,8 +38,8 @@ unit i_uefi;
             shortname    : 'uefi';
             shortname    : 'uefi';
             flags        : [tf_files_case_aware,tf_use_function_relative_addresses,tf_smartlink_library
             flags        : [tf_files_case_aware,tf_use_function_relative_addresses,tf_smartlink_library
                             ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},
                             ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},
-                            tf_no_generic_stackcheck{,tf_has_winlike_resources},tf_under_development,
-                            tf_dwarf_only_local_labels{,tf_pic_uses_got}];
+                            tf_no_generic_stackcheck{,tf_has_winlike_resources},tf_under_development//,
+                            {tf_dwarf_only_local_labels}{,tf_pic_uses_got}];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'UEFIUNITS';
             unit_env     : 'UEFIUNITS';
             extradefines : 'UEFI,FPC_OS_UNICODE';
             extradefines : 'UEFI,FPC_OS_UNICODE';
@@ -104,14 +104,14 @@ unit i_uefi;
             system       : system_x86_64_uefi;
             system       : system_x86_64_uefi;
             name         : 'UEFI for x86_64';
             name         : 'UEFI for x86_64';
             shortname    : 'uefi';
             shortname    : 'uefi';
-            flags        : [tf_files_case_aware,tf_use_function_relative_addresses
-                            ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},
-                            tf_no_generic_stackcheck{,tf_has_winlike_resources},tf_under_development,
-                            tf_dwarf_only_local_labels{,tf_pic_uses_got},tf_pic_default,tf_library_needs_pic];
+            flags        : [tf_files_case_aware,tf_use_function_relative_addresses,tf_smartlink_library
+                            ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},{tf_dwarf_relative_addresses,}
+                            tf_no_generic_stackcheck{,tf_has_winlike_resources},tf_under_development,{tf_no_pic_supported,}
+                            tf_dwarf_only_local_labels{,tf_pic_uses_got}{,tf_pic_default,tf_library_needs_pic}];
             cpu          : cpu_x86_64;
             cpu          : cpu_x86_64;
             unit_env     : 'UEFIUNITS';
             unit_env     : 'UEFIUNITS';
             extradefines : 'UEFI,FPC_OS_UNICODE';
             extradefines : 'UEFI,FPC_OS_UNICODE';
-            exeext       : '.exe';
+            exeext       : '.efi';
             defext       : '.def';
             defext       : '.def';
             scriptext    : '.bat';
             scriptext    : '.bat';
             smartext     : '.sl';
             smartext     : '.sl';
@@ -140,7 +140,7 @@ unit i_uefi;
             linkextern   : ld_none;
             linkextern   : ld_none;
             ar           : ar_gnu_ar;
             ar           : ar_gnu_ar;
             res          : res_gnu_windres;
             res          : res_gnu_windres;
-            dbg          : dbg_dwarf2;
+            dbg          : dbg_stabs;
             script       : script_dos;
             script       : script_dos;
             endian       : endian_little;
             endian       : endian_little;
             alignment    :
             alignment    :

+ 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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] 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 [system_x86_64_win64,system_x86_64_uefi] 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 }

+ 2 - 0
compiler/x86/aasmcpu.pas

@@ -3428,7 +3428,9 @@ implementation
                            currabsreloc:=RELOC_ABSOLUTE
                            currabsreloc:=RELOC_ABSOLUTE
                          else
                          else
 {$endif i8086}
 {$endif i8086}
+							begin
                              currabsreloc:=RELOC_ABSOLUTE32;
                              currabsreloc:=RELOC_ABSOLUTE32;
+                            end;
 
 
                            if (currabsreloc in [RELOC_ABSOLUTE32{$ifdef i8086},RELOC_ABSOLUTE{$endif}]) and
                            if (currabsreloc in [RELOC_ABSOLUTE32{$ifdef i8086},RELOC_ABSOLUTE{$endif}]) and
                             (Assigned(oper[opidx]^.ref^.relsymbol)) then
                             (Assigned(oper[opidx]^.ref^.relsymbol)) then

+ 1 - 1
compiler/x86/cgx86.pas

@@ -529,7 +529,7 @@ unit cgx86;
               end
               end
             else
             else
               { Always use RIP relative symbol addressing for Windows and Darwin targets. }
               { Always use RIP relative symbol addressing for Windows and Darwin targets. }
-              if (target_info.system in (systems_all_windows+[system_x86_64_darwin,system_x86_64_iphonesim])) and (ref.base<>NR_RIP) then
+              if (target_info.system in (systems_all_windows+[system_x86_64_darwin,system_x86_64_iphonesim,system_x86_64_uefi])) and (ref.base<>NR_RIP) then
                 begin
                 begin
                   if (ref.refaddr=addr_no) and (ref.base=NR_NO) and (ref.index=NR_NO) then
                   if (ref.refaddr=addr_no) and (ref.base=NR_NO) and (ref.index=NR_NO) then
                     begin
                     begin

+ 1 - 1
compiler/x86/nx86ld.pas

@@ -59,7 +59,7 @@ implementation
         handled:=false;
         handled:=false;
         if (tf_section_threadvars in target_info.flags) then
         if (tf_section_threadvars in target_info.flags) then
           begin
           begin
-            if target_info.system in [system_i386_win32,system_x86_64_win64] then
+            if target_info.system in [system_i386_win32,system_x86_64_win64,system_x86_64_uefi] then
               begin
               begin
                 paraloc1.init;
                 paraloc1.init;
                 pd:=search_system_proc('fpc_tls_add');
                 pd:=search_system_proc('fpc_tls_add');

+ 3 - 3
compiler/x86_64/cgcpu.pas

@@ -158,7 +158,7 @@ unit cgcpu;
         i: longint;
         i: longint;
       begin
       begin
         result:=0;
         result:=0;
-        if (target_info.system<>system_x86_64_win64) or
+        if (not(target_info.system in [system_x86_64_win64,system_x86_64_uefi])) or
            (not uses_registers(R_MMREGISTER)) then
            (not uses_registers(R_MMREGISTER)) then
           exit;
           exit;
         for i:=low(saved_mm_registers) to high(saved_mm_registers) do
         for i:=low(saved_mm_registers) to high(saved_mm_registers) do
@@ -397,7 +397,7 @@ unit cgcpu;
                 if (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then
                 if (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then
                   list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_ADDR],NR_FRAME_POINTER_REG));
                   list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_ADDR],NR_FRAME_POINTER_REG));
               end
               end
-            else if (target_info.system=system_x86_64_win64) then
+            else if (target_info.system in [system_x86_64_win64,system_x86_64_uefi]) then
               begin
               begin
                 { Comply with Win64 unwinding mechanism, which only recognizes
                 { Comply with Win64 unwinding mechanism, which only recognizes
                   'add $constant,%rsp' and 'lea offset(FPREG),%rsp' as belonging to
                   'add $constant,%rsp' and 'lea offset(FPREG),%rsp' as belonging to
@@ -516,7 +516,7 @@ unit cgcpu;
         if assigned(current_procinfo) then
         if assigned(current_procinfo) then
           use_ms_abi:=x86_64_use_ms_abi(current_procinfo.procdef.proccalloption)
           use_ms_abi:=x86_64_use_ms_abi(current_procinfo.procdef.proccalloption)
         else
         else
-          use_ms_abi:=target_info.system=system_x86_64_win64;
+          use_ms_abi:=target_info.system in [system_x86_64_win64,system_x86_64_uefi];
       end;
       end;
 
 
 
 

+ 3 - 3
compiler/x86_64/cpupi.pas

@@ -68,7 +68,7 @@ implementation
 
 
     procedure tcpuprocinfo.set_first_temp_offset;
     procedure tcpuprocinfo.set_first_temp_offset;
       begin
       begin
-        if target_info.system=system_x86_64_win64 then
+        if target_info.system in [system_x86_64_win64,system_x86_64_uefi] then
           begin
           begin
             { Fixes the case when there are calls done by low-level means
             { Fixes the case when there are calls done by low-level means
               (cg.a_call_name) but no child callnode }
               (cg.a_call_name) but no child callnode }
@@ -89,7 +89,7 @@ implementation
     procedure tcpuprocinfo.generate_parameter_info;
     procedure tcpuprocinfo.generate_parameter_info;
       begin
       begin
         inherited generate_parameter_info;
         inherited generate_parameter_info;
-        if target_info.system=system_x86_64_win64 then
+        if target_info.system in [system_x86_64_win64,system_x86_64_uefi] then
           para_stack_size:=0;
           para_stack_size:=0;
       end;
       end;
 
 
@@ -171,7 +171,7 @@ implementation
     function x86_64_use_ms_abi(proccall: tproccalloption): boolean;
     function x86_64_use_ms_abi(proccall: tproccalloption): boolean;
       begin
       begin
         result:=
         result:=
-           ((target_info.system=system_x86_64_win64) and
+           ((target_info.system in [system_x86_64_win64,system_x86_64_uefi]) and
             not(proccall in [pocall_sysv_abi_default,pocall_sysv_abi_cdecl])) or
             not(proccall in [pocall_sysv_abi_default,pocall_sysv_abi_cdecl])) or
            (proccall in [pocall_ms_abi_default,pocall_ms_abi_cdecl]);
            (proccall in [pocall_ms_abi_default,pocall_ms_abi_cdecl]);
       end;
       end;

+ 7 - 7
compiler/x86_64/nx64flw.pas

@@ -72,7 +72,7 @@ function tx64raisenode.pass_1 : tnode;
     raisenode : tcallnode;
     raisenode : tcallnode;
   begin
   begin
     { difference from generic code is that address stack is not popped on reraise }
     { difference from generic code is that address stack is not popped on reraise }
-    if (target_info.system<>system_x86_64_win64) or assigned(left) then
+    if (not(target_info.system in [system_x86_64_win64,system_x86_64_uefi])) or assigned(left) then
       result:=inherited pass_1
       result:=inherited pass_1
     else
     else
       begin
       begin
@@ -89,7 +89,7 @@ procedure tx64onnode.pass_generate_code;
   var
   var
     exceptvarsym : tlocalvarsym;
     exceptvarsym : tlocalvarsym;
   begin
   begin
-    if (target_info.system<>system_x86_64_win64) then
+    if (not(target_info.system in [system_x86_64_win64,system_x86_64_uefi])) then
       begin
       begin
         inherited pass_generate_code;
         inherited pass_generate_code;
         exit;
         exit;
@@ -153,7 +153,7 @@ function copy_parasize(var n: tnode; arg: pointer): foreachnoderesult;
 constructor tx64tryfinallynode.create(l, r: TNode);
 constructor tx64tryfinallynode.create(l, r: TNode);
   begin
   begin
     inherited create(l,r);
     inherited create(l,r);
-    if (target_info.system=system_x86_64_win64) and
+    if (target_info.system in [system_x86_64_win64,system_x86_64_uefi]) and
       { Don't create child procedures for generic methods, their nested-like
       { Don't create child procedures for generic methods, their nested-like
         behavior causes compilation errors because real nested procedures
         behavior causes compilation errors because real nested procedures
         aren't allowed for generics. Not creating them doesn't harm because
         aren't allowed for generics. Not creating them doesn't harm because
@@ -179,7 +179,7 @@ constructor tx64tryfinallynode.create(l, r: TNode);
 constructor tx64tryfinallynode.create_implicit(l, r, _t1: TNode);
 constructor tx64tryfinallynode.create_implicit(l, r, _t1: TNode);
   begin
   begin
     inherited create_implicit(l, r, _t1);
     inherited create_implicit(l, r, _t1);
-    if (target_info.system=system_x86_64_win64) then
+    if (target_info.system in [system_x86_64_win64,system_x86_64_uefi]) then
       begin
       begin
         if df_generic in current_procinfo.procdef.defoptions then
         if df_generic in current_procinfo.procdef.defoptions then
           InternalError(2013012501);
           InternalError(2013012501);
@@ -202,7 +202,7 @@ constructor tx64tryfinallynode.create_implicit(l, r, _t1: TNode);
 function tx64tryfinallynode.simplify(forinline: boolean): tnode;
 function tx64tryfinallynode.simplify(forinline: boolean): tnode;
   begin
   begin
     result:=inherited simplify(forinline);
     result:=inherited simplify(forinline);
-    if (target_info.system<>system_x86_64_win64) then
+    if (not(target_info.system in [system_x86_64_win64,system_x86_64_uefi])) then
       exit;
       exit;
     if (result=nil) then
     if (result=nil) then
       begin
       begin
@@ -243,7 +243,7 @@ procedure tx64tryfinallynode.pass_generate_code;
     oldflowcontrol: tflowcontrol;
     oldflowcontrol: tflowcontrol;
     catch_frame: boolean;
     catch_frame: boolean;
   begin
   begin
-    if (target_info.system<>system_x86_64_win64) then
+    if (not(target_info.system in [system_x86_64_win64,system_x86_64_uefi])) then
       begin
       begin
         inherited pass_generate_code;
         inherited pass_generate_code;
         exit;
         exit;
@@ -372,7 +372,7 @@ procedure tx64tryexceptnode.pass_generate_code;
   label
   label
     errorexit;
     errorexit;
   begin
   begin
-    if (target_info.system<>system_x86_64_win64) then
+    if (not(target_info.system in [system_x86_64_win64,system_x86_64_uefi])) then
       begin
       begin
         inherited pass_generate_code;
         inherited pass_generate_code;
         exit;
         exit;

+ 1 - 1
compiler/x86_64/rax64att.pas

@@ -74,7 +74,7 @@ Unit rax64att;
         i: TAsmSehDirective;
         i: TAsmSehDirective;
       begin
       begin
         result:=false;
         result:=false;
-        if target_info.system<>system_x86_64_win64 then
+        if not(target_info.system in [system_x86_64_win64,system_x86_64_uefi]) then
           exit;
           exit;
 
 
         for i:=low(TAsmSehDirective) to high(TAsmSehDirective) do
         for i:=low(TAsmSehDirective) to high(TAsmSehDirective) do