Browse Source

* use only windows exceptions for stack checking on win32/win64, resolves #9166

git-svn-id: trunk@9020 -
florian 18 years ago
parent
commit
90af7ebf72
6 changed files with 24 additions and 7 deletions
  1. 6 0
      compiler/options.pas
  2. 2 1
      compiler/psub.pas
  3. 3 1
      compiler/systems.pas
  4. 5 2
      compiler/systems/i_win.pas
  5. 5 0
      rtl/inc/system.inc
  6. 3 3
      rtl/win32/system.pp

+ 6 - 0
compiler/options.pas

@@ -1986,6 +1986,12 @@ begin
     else
       def_system_macro('FPC_CPUCROSSCOMPILING');
 
+  if (tf_no_generic_stackcheck in target_info.flags) then
+    if def then
+      def_system_macro('FPC_NO_GENERIC_STACK_CHECK')
+    else
+      undef_system_macro('FPC_NO_GENERIC_STACK_CHECK');
+
   { Code generation flags }
   if def and
      (tf_pic_default in target_info.flags) then

+ 2 - 1
compiler/psub.pas

@@ -996,7 +996,8 @@ implementation
 
             { Already reserve all registers for stack checking code and
               generate the call to the helper function }
-            if (cs_check_stack in entryswitches) and
+            if not(tf_no_generic_stackcheck in target_info.flags) and
+               (cs_check_stack in entryswitches) and
                not(po_assembler in procdef.procoptions) and
                (procdef.proctypeoption<>potype_proginit) then
               begin

+ 3 - 1
compiler/systems.pas

@@ -312,7 +312,9 @@ interface
             tf_dwarf_only_local_labels,          // only use local labels inside the Dwarf debug_info section (needed for e.g. Darwin)
             tf_requires_proper_alignment,
             tf_no_pic_supported,
-            tf_pic_default
+            tf_pic_default,
+            { the os does some kind of stack checking and it can be converted into a rte 202 }
+            tf_no_generic_stackcheck
        );
 
        psysteminfo = ^tsysteminfo;

+ 5 - 2
compiler/systems/i_win.pas

@@ -33,7 +33,9 @@ unit i_win;
             name         : 'Win32 for i386';
             shortname    : 'Win32';
             flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses,tf_smartlink_library
-                            ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},tf_winlikewidestring,tf_no_pic_supported];
+                            ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},
+                            tf_winlikewidestring,tf_no_pic_supported,
+                            tf_no_generic_stackcheck];
             cpu          : cpu_i386;
             unit_env     : 'WIN32UNITS';
             extradefines : 'MSWINDOWS;WINDOWS';
@@ -93,7 +95,8 @@ unit i_win;
             name         : 'Win64 for x64';
             shortname    : 'Win64';
             flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses,
-                            tf_smartlink_sections,tf_smartlink_library,tf_winlikewidestring,tf_no_pic_supported];
+                            tf_smartlink_sections,tf_smartlink_library,tf_winlikewidestring,tf_no_pic_supported,
+                            tf_no_generic_stackcheck];
             cpu          : cpu_x86_64;
             unit_env     : 'WIN64UNITS';
             extradefines : 'MSWINDOWS;WINDOWS';

+ 5 - 0
rtl/inc/system.inc

@@ -653,6 +653,11 @@ end;
                          Stack check code
 *****************************************************************************}
 
+{ be compatible with old code }
+{$ifdef FPC_NO_GENERIC_STACK_CHECK}
+{$define NO_GENERIC_STACK_CHECK}
+{$endif FPC_NO_GENERIC_STACK_CHECK}
+
 {$IFNDEF NO_GENERIC_STACK_CHECK}
 
 {$IFOPT S+}

+ 3 - 3
rtl/win32/system.pp

@@ -1109,11 +1109,11 @@ begin
   StackBottom := StackTop - StackLength;
   { get some helpful informations }
   GetStartupInfo(@startupinfo);
-  
-  SysResetFPU;  
+
+  SysResetFPU;
   if not(IsLibrary) then
     SysInitFPU;
-  
+
   { some misc Win32 stuff }
   hprevinst:=0;
   if not IsLibrary then