Browse Source

* For some unknown reason WM 6.1 requires .idata section to be read only. Otherwise it refuses to load DLLs greater than 64KB. Earlier versions of WinCE load DLLs regardless of .idata flags.

git-svn-id: trunk@11421 -
yury 17 years ago
parent
commit
22df9855d9
1 changed files with 13 additions and 1 deletions
  1. 13 1
      compiler/ogcoff.pas

+ 13 - 1
compiler/ogcoff.pas

@@ -2120,7 +2120,8 @@ const pemagic : array[0..3] of byte = (
         peoptheader : tcoffpeoptheader;
         peoptheader : tcoffpeoptheader;
         textExeSec,
         textExeSec,
         dataExeSec,
         dataExeSec,
-        bssExeSec   : TExeSection;
+        bssExeSec,
+        idataExeSec : TExeSection;
         hassymbols  : boolean;
         hassymbols  : boolean;
 
 
         procedure UpdateDataDir(const secname:string;idx:longint);
         procedure UpdateDataDir(const secname:string;idx:longint);
@@ -2258,6 +2259,17 @@ const pemagic : array[0..3] of byte = (
             djoptheader.entry:=EntrySym.offset;
             djoptheader.entry:=EntrySym.offset;
             FWriter.write(djoptheader,sizeof(djoptheader));
             FWriter.write(djoptheader,sizeof(djoptheader));
           end;
           end;
+          
+        { For some unknown reason WM 6.1 requires .idata section to be read only.
+          Otherwise it refuses to load DLLs greater than 64KB.
+          Earlier versions of WinCE load DLLs regardless of .idata flags. }
+        if target_info.system in [system_arm_wince,system_i386_wince] then
+          begin
+            idataExeSec:=FindExeSection('.idata');
+            if idataExeSec<>nil then
+              idataExeSec.SecOptions:=idataExeSec.SecOptions - [oso_write] + [oso_readonly];
+          end;
+
         { Section headers }
         { Section headers }
         ExeSectionList.ForEachCall(@ExeSectionList_write_header,nil);
         ExeSectionList.ForEachCall(@ExeSectionList_write_header,nil);
         { Section data }
         { Section data }