Browse Source

* 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: branches/olivier/uefi@36142 -
olivier 8 years ago
parent
commit
3b5d32a510
1 changed files with 17 additions and 1 deletions
  1. 17 1
      compiler/pmodules.pas

+ 17 - 1
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