ソースを参照

* make sure that the stack size passed to emxbind is valid (override the value passed using $M if necessary)

git-svn-id: trunk@29573 -
Tomas Hajny 10 年 前
コミット
608b14ab4e
1 ファイル変更7 行追加0 行削除
  1. 7 0
      compiler/systems/t_os2.pas

+ 7 - 0
compiler/systems/t_os2.pas

@@ -473,6 +473,7 @@ var
   BaseFilename: TPathStr;
   RsrcStr : string;
   OutName: TPathStr;
+  StackSizeKB: cardinal;
 begin
   if not(cs_link_nolink in current_settings.globalswitches) then
    Message1(exec_i_linking,current_module.exefilename);
@@ -513,6 +514,12 @@ begin
         { Is this really required? Not anymore according to my EMX docs }
         Replace(cmdstr,'$HEAPMB',tostr((1048575) shr 20));
         {Size of the stack when an EMX program runs in OS/2.}
+        StackSizeKB := (StackSize + 1023) shr 10;
+        (* Ensure a value which might work and is accepted by EMXBIND *)
+        if StackSizeKB < 64 then
+         StackSizeKB := 64
+        else if StackSizeKB > (512 shl 10) then
+         StackSizeKB := 512 shl 10;
         Replace(cmdstr,'$STACKKB',tostr((stacksize+1023) shr 10));
         {When an EMX program runs in DOS, the heap and stack share the
          same memory pool. The heap grows upwards, the stack grows downwards.}