summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorolivier <olivier@3ad0048d-3df7-0310-abae-a5850022a9f2>2017-05-06 21:40:18 +0000
committerolivier <olivier@3ad0048d-3df7-0310-abae-a5850022a9f2>2017-05-06 21:40:18 +0000
commit964bb38f5f7eb794bc915588dd94d4f0449726c3 (patch)
tree7dd81b2afa47c42e12d7bb005bff252e6fdf9ec5
parente5c50c36c7cee9e63874324f52c51fe1d4aa73b5 (diff)
downloadfpc-964bb38f5f7eb794bc915588dd94d4f0449726c3.tar.gz
* Quick and dirty hack to generate a dll even if a program is compiled.
This allows to compile a canonical "Hello, World !" to the UEFI target "out of the box". It is purely syntactic sugar though... Note : under UEFI, every binaries are technically dlls. Warning : This should be discussed with core developers first in case of merging with trunk at some point in the futur... git-svn-id: https://svn.freepascal.org/svn/fpc/branches/olivier@36142 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--uefi/compiler/pmodules.pas18
1 files changed, 17 insertions, 1 deletions
diff --git a/uefi/compiler/pmodules.pas b/uefi/compiler/pmodules.pas
index c662cba6b2..117b3b6bae 100644
--- a/uefi/compiler/pmodules.pas
+++ b/uefi/compiler/pmodules.pas
@@ -1865,6 +1865,10 @@ type
i : Longint;
sysinitmod: tmodule;
begin
+ // Under UEFI, an application is technically a dll.
+ // So, we build both programs and libraries as libraries
+ if target_info.system in [system_i386_uefi] then
+ IsLibrary := true;
Status.IsLibrary:=IsLibrary;
Status.IsPackage:=false;
Status.IsExe:=true;
@@ -1911,7 +1915,19 @@ type
if islibrary then
begin
- consume(_LIBRARY);
+ if target_info.system in [system_i386_uefi] then
+ begin
+ // For UEFI targets, every binaries are libraries.
+ // So, we treat 'program' as 'library' as well.
+ if not try_to_consume(_LIBRARY) then
+ begin
+ consume(_PROGRAM);
+ end;
+ end
+ else
+ begin
+ consume(_LIBRARY);
+ end;
program_name:=orgpattern;
consume(_ID);
while token=_POINT do