Ver código fonte

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

yury 17 anos atrás
pai
commit
d5a3a28379
2 arquivos alterados com 6 adições e 6 exclusões
  1. 5 5
      compiler/ogcoff.pas
  2. 1 1
      compiler/scandir.pas

+ 5 - 5
compiler/ogcoff.pas

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

+ 1 - 1
compiler/scandir.pas

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