diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2009-11-03 22:49:37 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2009-11-03 22:49:37 +0000 |
commit | d809253a56a642cdeb31f3f12e420f092cee0d07 (patch) | |
tree | f611e7abf6528b7dc5e27a9acf00f201c85571a7 /gcc/doc | |
parent | 24d179b4c7717ceeceef16166064bd4a3933cb11 (diff) | |
download | gcc-d809253a56a642cdeb31f3f12e420f092cee0d07.zip gcc-d809253a56a642cdeb31f3f12e420f092cee0d07.tar.gz gcc-d809253a56a642cdeb31f3f12e420f092cee0d07.tar.bz2 |
re PR target/10127 (-fstack-check let's program crash)
PR target/10127
PR ada/20548
* expr.h (STACK_CHECK_PROBE_INTERVAL): Delete.
(STACK_CHECK_PROBE_INTERVAL_EXP): New macro.
(STACK_CHECK_MOVING_SP): Likewise.
* system.h (STACK_CHECK_PROBE_INTERVAL): Poison it.
* doc/tm.texi (Stack Checking): Delete STACK_CHECK_PROBE_INTERVAL.
Document STACK_CHECK_PROBE_INTERVAL_EXP and STACK_CHECK_MOVING_SP.
* doc/md.texi (Standard Pattern Names): Tweak entry of CHECK_STACK.
Document PROBE_STACK.
* explow.c (anti_adjust_stack_and_probe): New function.
(allocate_dynamic_stack_space): Do not directly allocate space if
STACK_CHECK_MOVING_SP, instead invoke above function.
(emit_stack_probe): Handle probe_stack insn.
(PROBE_INTERVAL): New macro.
(STACK_GROW_OPTAB): Likewise.
(STACK_GROW_OFF): Likewise.
(probe_stack_range): Use Pmode and memory_address consistently. Fix
loop condition in the small constant case. Rewrite in the general
case to be immune to wraparounds. Make sure the address of probes
is valid. Try to use [base + disp] addressing mode if possible.
* ira.c (setup_eliminable_regset): Set frame_pointer_needed if stack
checking is enabled and STACK_CHECK_MOVING_SP.
* rtlanal.c (may_trap_p_1) <MEM>: If stack checking is enabled,
return 1 for volatile references to the stack pointer.
* tree.c (build_common_builtin_nodes): Do not set ECF_NOTHROW on
__builtin_alloca if stack checking is enabled.
* unwind-dw2.c (uw_identify_context): Take into account whether the
context is that of a signal frame or not.
* config/i386/linux.h (STACK_CHECK_MOVING_SP): Define to 1.
* config/i386/linux64.h (STACK_CHECK_MOVING_SP): Likewise.
From-SVN: r153877
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/md.texi | 18 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 20 |
2 files changed, 28 insertions, 10 deletions
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index dcfba92..2974dcf 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -5037,11 +5037,19 @@ operations in addition to updating the stack pointer. @item @samp{check_stack} If stack checking cannot be done on your system by probing the stack with a load or store instruction (@pxref{Stack Checking}), define this pattern -to perform the needed check and signaling an error if the stack -has overflowed. The single operand is the location in the stack furthest -from the current stack pointer that you need to validate. Normally, -on machines where this pattern is needed, you would obtain the stack -limit from a global or thread-specific variable or register. +to perform the needed check and signal an error if the stack has overflowed. +The single operand is the address in the stack furthest from the current +stack pointer that you need to validate. Normally, on machines where this +pattern is needed, you would obtain the stack limit from a global or +thread-specific variable or register. + +@cindex @code{probe_stack} instruction pattern +@item @samp{probe_stack} +If stack checking can be done on your system by probing the stack but doing +it with a load or store instruction is not optimal (@pxref{Stack Checking}), +define this pattern to do the probing differently and signal an error if +the stack has overflowed. The single operand is the memory location in the +stack that needs to be probed. @cindex @code{nonlocal_goto} instruction pattern @item @samp{nonlocal_goto} diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 984bbd7..c69ef0c 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3556,11 +3556,12 @@ 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 -An integer representing the interval at which GCC must generate stack -probe instructions. You will normally define this macro to be no larger -than the size of the ``guard pages'' at the end of a stack area. The -default value of 4096 is suitable for most systems. +@defmac STACK_CHECK_PROBE_INTERVAL_EXP +An integer specifying the interval at which GCC must generate stack probe +instructions, defined as 2 raised to this integer. You will normally +define this macro so that the interval be no larger than the size of +the ``guard pages'' at the end of a stack area. The default value +of 12 (4096-byte interval) is suitable for most systems. @end defmac @defmac STACK_CHECK_PROBE_LOAD @@ -3569,6 +3570,15 @@ 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 +@defmac STACK_CHECK_MOVING_SP +An integer which is nonzero if GCC should move the stack pointer page by page +when doing probes. This can be necessary on systems where the stack pointer +contains the bottom address of the memory area accessible to the executing +thread at any point in time. In this situation an alternate signal stack +is required in order to be able to recover from a stack overflow. The +default value of this macro is zero. +@end defmac + @defmac STACK_CHECK_PROTECT The number of bytes of stack needed to recover from a stack overflow, for languages where such a recovery is supported. The default value of |