summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorolivier <olivier@3ad0048d-3df7-0310-abae-a5850022a9f2>2017-05-02 00:00:45 +0000
committerolivier <olivier@3ad0048d-3df7-0310-abae-a5850022a9f2>2017-05-02 00:00:45 +0000
commit309384e53b93337e4f5bdea5a08dbc6c054e00ae (patch)
treefec83e1d7d03b62279b8414e2d1bf5e64007ab2c
parent0ae856641518da7fa0c8191fcd426b85eccae95b (diff)
downloadfpc-309384e53b93337e4f5bdea5a08dbc6c054e00ae.tar.gz
+ Set UEFI application kind in the generated binary header
git-svn-id: https://svn.freepascal.org/svn/fpc/branches/olivier@36058 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--uefi/compiler/globtype.pas6
-rw-r--r--uefi/compiler/ogcoff.pas14
-rw-r--r--uefi/compiler/options.pas4
3 files changed, 23 insertions, 1 deletions
diff --git a/uefi/compiler/globtype.pas b/uefi/compiler/globtype.pas
index 073813b6e7..ec17a83232 100644
--- a/uefi/compiler/globtype.pas
+++ b/uefi/compiler/globtype.pas
@@ -449,7 +449,11 @@ interface
app_arm7, { for Nintendo DS target }
app_arm9, { for Nintendo DS target }
app_bundle, { dynamically loadable bundle, Darwin only }
- app_com { DOS .COM file }
+ app_com, { DOS .COM file }
+ app_efi_app, { EFI application (UEFI target) }
+ app_efi_boot, { EFI boot driver (UEFI target) }
+ app_efi_run, { EFI runtime driver (UEFI target) }
+ app_efi_rom { EFI ROM (UEFI target) }
);
{ interface types }
diff --git a/uefi/compiler/ogcoff.pas b/uefi/compiler/ogcoff.pas
index 79be8bd5c1..df3216dd60 100644
--- a/uefi/compiler/ogcoff.pas
+++ b/uefi/compiler/ogcoff.pas
@@ -340,6 +340,9 @@ implementation
PE_SUBSYSTEM_WINDOWS_GUI = 2;
PE_SUBSYSTEM_WINDOWS_CUI = 3;
PE_SUBSYSTEM_WINDOWS_CE_GUI = 9;
+ PE_SUBSYSTEM_EFI_APP = 10;
+ PE_SUBSYSTEM_EFI_BOOT = 11;
+ PE_SUBSYSTEM_EFI_RUN = 12;
PE_FILE_RELOCS_STRIPPED = $0001;
PE_FILE_EXECUTABLE_IMAGE = $0002;
@@ -2578,6 +2581,17 @@ const pemagic : array[0..3] of byte = (
else
if target_info.system in systems_wince then
peoptheader.Subsystem:=PE_SUBSYSTEM_WINDOWS_CE_GUI
+ else if target_info.system in [system_i386_uefi] then
+ begin
+ case apptype of
+ app_efi_app :
+ peoptheader.Subsystem:=PE_SUBSYSTEM_EFI_APP;
+ app_efi_boot :
+ peoptheader.Subsystem:=PE_SUBSYSTEM_EFI_BOOT;
+ app_efi_run :
+ peoptheader.Subsystem:=PE_SUBSYSTEM_EFI_RUN;
+ end;
+ end
else
if apptype=app_gui then
peoptheader.Subsystem:=PE_SUBSYSTEM_WINDOWS_GUI
diff --git a/uefi/compiler/options.pas b/uefi/compiler/options.pas
index 2adcc8d1bf..7240228cf2 100644
--- a/uefi/compiler/options.pas
+++ b/uefi/compiler/options.pas
@@ -2174,6 +2174,10 @@ begin
else
SetApptype(app_native);
end
+ else if target_info.system in [system_i386_uefi] then
+ begin
+ SetApptype(app_efi_app);
+ end
else
IllegalPara(opt);
end;