diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-08-16 18:40:57 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-08-16 18:40:57 +0000 |
commit | b38f3813f7ba380b33607e114a7efa9901191924 (patch) | |
tree | 4ab818c332a67c5a5e24c9d78cedd1099ebc04e2 /gcc/doc | |
parent | 6c397102b275823c0d8ffb02ab7d74bb38ede5a9 (diff) | |
download | gcc-b38f3813f7ba380b33607e114a7efa9901191924.zip gcc-b38f3813f7ba380b33607e114a7efa9901191924.tar.gz gcc-b38f3813f7ba380b33607e114a7efa9901191924.tar.bz2 |
re PR middle-end/20548 (ACATS c52103x c52104x c52104y segfault)
PR ada/20548
* common.opt (-fstack-check): Do not declare the variable here.
(-fstack-check=): New option variant.
* doc/invoke.texi (Code Gen Options): Document it.
* expr.h (STACK_OLD_CHECK_PROTECT): New macro.
(STACK_CHECK_PROTECT): Bump to 3 pages if DWARF-2 EH is used.
(STACK_CHECK_STATIC_BUILTIN): New macro.
* doc/tm.texi (Stack Checking): Document STACK_CHECK_STATIC_BUILTIN.
* opts.c: Include expr.h.
(common_handle_option) <OPT_fold_stack_check_>: New case.
<OPT_fstack_check>: Likewise.
* calls.c (initialize_argument_information): Use TYPE_SIZE_UNIT
consistently in the test for variable-sized types. Adjust for
new behaviour of flag_stack_check.
* explow.c: Include except.h.
(allocate_dynamic_stack_space): Do not take into account
STACK_CHECK_MAX_FRAME_SIZE for static builtin stack checking.
* function.c (gimplify_parameters): Use DECL_SIZE_UNIT in the test
for variable-sized parameters. Treat all parameters whose size is
greater than STACK_CHECK_MAX_VAR_SIZE as variable-sized if generic
stack checking is enabled.
* gimplify.c (gimplify_decl_expr): Treat non-static objects whose
size is greater than STACK_CHECK_MAX_VAR_SIZE as variable-sized
if generic stack checking is enabled.
(expand_function_end): Adjust for new behaviour of flag_stack_check.
* reload1.c (reload): Likewise.
* stmt.c (expand_decl): Assert that all automatic variables have
fixed size at this point and remove dead code.
* flags.h (stack_check_type): New enumeration type.
(flag_stack_check): Declare.
* toplev.c (flag_stack_check): New global variable.
* Makefile.in (opts.o): Add dependency on EXPR_H.
(explow.o): Add dependency on except.h.
ada/
* gcc-interface/decl.c (gnat_to_gnu_entity): Use DECL_SIZE_UNIT in the
setjmp test consistently. Adjust for new behaviour of flag_stack_check.
* gcc-interface/utils2.c (build_call_alloc_dealloc): Remove redundant
test of flag_stack_check. Adjust for new behaviour of flag_stack_check.
From-SVN: r139159
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 30 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 49 |
2 files changed, 60 insertions, 19 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 56a0bda..40c3df1 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -15207,8 +15207,34 @@ a single-threaded environment since stack overflow is automatically detected on nearly all systems if there is only one stack. Note that this switch does not actually cause checking to be done; the -operating system must do that. The switch causes generation of code -to ensure that the operating system sees the stack being extended. +operating system or the language runtime must do that. The switch causes +generation of code to ensure that they see the stack being extended. + +You can additionally specify a string parameter: @code{no} means no +checking, @code{generic} means force the use of old-style checking, +@code{specific} means use the best checking method and is equivalent +to bare @option{-fstack-check}. + +Old-style checking is a generic mechanism that requires no specific +target support in the compiler but comes with the following drawbacks: + +@enumerate +@item +Modified allocation strategy for large objects: they will always be +allocated dynamically if their size exceeds a fixed threshold. + +@item +Fixed limit on the size of the static frame of functions: when it is +topped by a particular function, stack checking is not reliable and +a warning is issued by the compiler. + +@item +Inefficiency: because of both the modified allocation strategy and the +generic implementation, the performances of the code are hampered. +@end enumerate + +Note that old-style stack checking is also the fallback method for +@code{specific} if no target support has been added in the compiler. @item -fstack-limit-register=@var{reg} @itemx -fstack-limit-symbol=@var{sym} diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 5decc33..9b4a921 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3376,38 +3376,49 @@ linkage is necessary. The default is @code{0}. @node Stack Checking @subsection Specifying How Stack Checking is Done -GCC will check that stack references are within the boundaries of -the stack, if the @option{-fstack-check} is specified, in one of three ways: +GCC will check that stack references are within the boundaries of the +stack, if the option @option{-fstack-check} is specified, in one of +three ways: @enumerate @item If the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCC -will assume that you have arranged for stack checking to be done at -appropriate places in the configuration files, e.g., in -@code{TARGET_ASM_FUNCTION_PROLOGUE}. GCC will do not other special -processing. +will assume that you have arranged for full stack checking to be done +at appropriate places in the configuration files. GCC will not do +other special processing. @item -If @code{STACK_CHECK_BUILTIN} is zero and you defined a named pattern -called @code{check_stack} in your @file{md} file, GCC will call that -pattern with one argument which is the address to compare the stack -value against. You must arrange for this pattern to report an error if -the stack pointer is out of range. +If @code{STACK_CHECK_BUILTIN} is zero and the value of the +@code{STACK_CHECK_STATIC_BUILTIN} macro is nonzero, GCC will assume +that you have arranged for static stack checking (checking of the +static stack frame of functions) to be done at appropriate places +in the configuration files. GCC will only emit code to do dynamic +stack checking (checking on dynamic stack allocations) using the third +approach below. @item If neither of the above are true, GCC will generate code to periodically ``probe'' the stack pointer using the values of the macros defined below. @end enumerate -Normally, you will use the default values of these macros, so GCC -will use the third approach. +If neither STACK_CHECK_BUILTIN nor STACK_CHECK_STATIC_BUILTIN is defined, +GCC will change its allocation strategy for large objects if the option +@option{-fstack-check} is specified: they will always be allocated +dynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes. @defmac STACK_CHECK_BUILTIN A nonzero value if stack checking is done by the configuration files in a machine-dependent manner. You should define this macro if stack checking -is require by the ABI of your machine or if you would like to have to stack -checking in some more efficient way than GCC's portable approach. -The default value of this macro is zero. +is require by the ABI of your machine or if you would like to do stack +checking in some more efficient way than the generic approach. The default +value of this macro is zero. +@end defmac + +@defmac STACK_CHECK_STATIC_BUILTIN +A nonzero value if static stack checking is done by the configuration files +in a machine-dependent manner. You should define this macro if you would +like to do static stack checking in some more efficient way than the generic +approach. The default value of this macro is zero. @end defmac @defmac STACK_CHECK_PROBE_INTERVAL @@ -3418,7 +3429,7 @@ default value of 4096 is suitable for most systems. @end defmac @defmac STACK_CHECK_PROBE_LOAD -A integer which is nonzero if GCC should perform the stack probe +An integer which is nonzero if GCC should perform the stack probe as a load instruction and zero if GCC should use a store instruction. The default is zero, which is the most efficient choice on most systems. @end defmac @@ -3429,6 +3440,10 @@ for languages where such a recovery is supported. The default value of 75 words should be adequate for most machines. @end defmac +The following macros are relevant only if neither STACK_CHECK_BUILTIN +nor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogether +in the opposite case. + @defmac STACK_CHECK_MAX_FRAME_SIZE The maximum size of a stack frame, in bytes. GCC will generate probe instructions in non-leaf functions to ensure at least this many bytes of |