* Set PE_FILE_LARGE_ADDRESS_AWARE flag for win64 executables to allow access more than 2GB of memory.

* Fixed $setpeflags directive. Flags should be set in main PE header. LoaderFlags in optional header are obsolete.

git-svn-id: trunk@11433 -
This commit is contained in:
yury 2008-07-22 11:53:55 +00:00
parent 0c002889b0
commit d5a3a28379
2 changed files with 6 additions and 6 deletions

View File

@ -2173,7 +2173,9 @@ const pemagic : array[0..3] of byte = (
if win32 then
begin
header.flag:=PE_FILE_EXECUTABLE_IMAGE or PE_FILE_LINE_NUMS_STRIPPED;
if target_info.system in [system_i386_win32,system_arm_wince,system_i386_wince] then
if target_info.system in [system_x86_64_win64] then
header.flag:=header.flag or PE_FILE_LARGE_ADDRESS_AWARE
else
header.flag:=header.flag or PE_FILE_32BIT_MACHINE;
if IsSharedLibrary then
header.flag:=header.flag or PE_FILE_DLL;
@ -2185,6 +2187,8 @@ const pemagic : array[0..3] of byte = (
header.flag:=header.flag or PE_FILE_DEBUG_STRIPPED;
if not hassymbols then
header.flag:=header.flag or PE_FILE_LOCAL_SYMS_STRIPPED;
if SetPEFlagsSetExplicity then
header.flag:=header.flag or peflags;
end
else
header.flag:=COFF_FLAG_AR32WR or COFF_FLAG_EXE or COFF_FLAG_NORELOCS or COFF_FLAG_NOLINES;
@ -2233,10 +2237,6 @@ const pemagic : array[0..3] of byte = (
peoptheader.SizeOfStackCommit:=$1000;
peoptheader.SizeOfHeapReserve:=$100000;
peoptheader.SizeOfHeapCommit:=$1000;
if SetPEFlagsSetExplicity then
peoptheader.LoaderFlags:=peflags
else
peoptheader.LoaderFlags:=0;
peoptheader.NumberOfRvaAndSizes:=PE_DATADIR_ENTRIES;
UpdateDataDir('.idata',PE_DATADIR_IDATA);
UpdateDataDir('.edata',PE_DATADIR_EDATA);

View File

@ -1042,7 +1042,7 @@ implementation
procedure dir_setpeflags;
begin
if not (target_info.system in (system_windows+system_wince)) then
if not (target_info.system in (system_all_windows)) then
Message(scan_w_setpeflags_not_support);
current_scanner.skipspace;
peflags:=current_scanner.readval;