+ support setpeoptflags directive, resolves #23447

git-svn-id: trunk@23132 -
This commit is contained in:
florian 2012-12-10 19:17:25 +00:00
parent d180d6f241
commit db68214e88
8 changed files with 633 additions and 605 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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
);

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -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
tests/webtbs/tw23447.pp Normal file
View File

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