Prechádzať zdrojové kódy

+ support setpeoptflags directive, resolves #23447

git-svn-id: trunk@23132 -
florian 12 rokov pred
rodič
commit
db68214e88

+ 1 - 0
.gitattributes

@@ -13014,6 +13014,7 @@ tests/webtbs/tw2328.pp svneol=native#text/plain
 tests/webtbs/tw2332.pp svneol=native#text/plain
 tests/webtbs/tw23342.pp svneol=native#text/pascal
 tests/webtbs/tw23436.pp svneol=native#text/plain
+tests/webtbs/tw23447.pp svneol=native#text/pascal
 tests/webtbs/tw2351.pp svneol=native#text/plain
 tests/webtbs/tw2363.pp svneol=native#text/plain
 tests/webtbs/tw2377.pp svneol=native#text/plain

+ 3 - 0
compiler/globals.pas

@@ -260,6 +260,7 @@ interface
        usewindowapi  : boolean;
        description   : string;
        SetPEFlagsSetExplicity,
+       SetPEOptFlagsSetExplicity,
        ImageBaseSetExplicity,
        MinStackSizeSetExplicity,
        MaxStackSizeSetExplicity,
@@ -269,6 +270,7 @@ interface
        dllminor,
        dllrevision   : word;  { revision only for netware }
        { win pe  }
+       peoptflags,
        peflags : longint;
        minstacksize,
        maxstacksize,
@@ -1605,6 +1607,7 @@ implementation
         description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
         DescriptionSetExplicity:=false;
         SetPEFlagsSetExplicity:=false;
+        SetPEOptFlagsSetExplicity:=false;
         ImageBaseSetExplicity:=false;
         MinStackSizeSetExplicity:=false;
         MaxStackSizeSetExplicity:=false;

+ 2 - 0
compiler/msg/errore.msg

@@ -386,6 +386,8 @@ scan_w_unavailable_system_codepage=02091_W_Current system codepage "$1" is not a
 % The compiler is compiled with support for several codepages built-in.
 % The codepage of the operation system is not in that list. You will need to recompile
 % the compiler with support for this codepage.
+scan_w_setpeoptflags_not_support=02092_W_SETPEOPTFLAGS is not supported by the target OS
+% The \var{\{\$SETPEOPTFLAGS\}} directive is not supported by the target OS.
 % \end{description}
 #
 # Parser

+ 3 - 2
compiler/msgidx.inc

@@ -113,6 +113,7 @@ const
   scanner_f_illegal_utf8_bom=02089;
   scanner_w_directive_ignored_on_target=02090;
   scan_w_unavailable_system_codepage=02091;
+  scan_w_setpeoptflags_not_support=02092;
   parser_e_syntax_error=03000;
   parser_e_dont_nest_interrupt=03004;
   parser_w_proc_directive_ignored=03005;
@@ -961,9 +962,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 67940;
+  MsgTxtSize = 67996;
 
   MsgIdxMax : array[1..20] of longint=(
-    26,92,328,120,87,56,125,26,202,63,
+    26,93,328,120,87,56,125,26,202,63,
     54,20,1,1,1,1,1,1,1,1
   );

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 391 - 391
compiler/msgtxt.inc


+ 6 - 1
compiler/ogcoff.pas

@@ -2309,7 +2309,12 @@ const pemagic : array[0..3] of byte = (
                   peoptheader.Subsystem:=PE_SUBSYSTEM_WINDOWS_GUI
                 else
                   peoptheader.Subsystem:=PE_SUBSYSTEM_WINDOWS_CUI;
-            peoptheader.DllCharacteristics:=0;
+
+            if SetPEOptFlagsSetExplicity then
+              peoptheader.DllCharacteristics:=peoptflags
+            else
+              peoptheader.DllCharacteristics:=0;
+
             peoptheader.SizeOfStackReserve:=stacksize;
             peoptheader.SizeOfStackCommit:=$1000;
             if MinStackSizeSetExplicity then

+ 11 - 1
compiler/scandir.pas

@@ -1089,10 +1089,19 @@ unit scandir;
         if not (target_info.system in (systems_all_windows)) then
           Message(scan_w_setpeflags_not_support);
         current_scanner.skipspace;
-        peflags:=current_scanner.readval;
+        peflags:=peflags or current_scanner.readval;
         SetPEFlagsSetExplicity:=true;
       end;
 
+    procedure dir_setpeoptflags;
+      begin
+        if not (target_info.system in (systems_all_windows)) then
+          Message(scan_w_setpeoptflags_not_support);
+        current_scanner.skipspace;
+        peoptflags:=peoptflags or current_scanner.readval;
+        SetPEOptFlagsSetExplicity:=true;
+      end;
+
     procedure dir_smartlink;
       begin
         do_moduleswitch(cs_create_smart);
@@ -1573,6 +1582,7 @@ unit scandir;
         AddDirective('SAFEFPUEXCEPTIONS',directive_all, @dir_safefpuexceptions);
         AddDirective('SCOPEDENUMS',directive_all, @dir_scopedenums);
         AddDirective('SETPEFLAGS', directive_all, @dir_setpeflags);
+        AddDirective('SETPEOPTFLAGS', directive_all, @dir_setpeoptflags);
         AddDirective('SCREENNAME',directive_all, @dir_screenname);
         AddDirective('SMARTLINK',directive_all, @dir_smartlink);
         AddDirective('STACKFRAMES',directive_all, @dir_stackframes);

+ 6 - 0
tests/webtbs/tw23447.pp

@@ -0,0 +1,6 @@
+{ %target=win32,win64,wince }
+{ %opt=-Sew }
+{$setpeoptflags $0140}
+begin
+end.
+

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov