aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/tm.texi
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2018-10-01 12:58:21 +0000
committerTamar Christina <tnfchris@gcc.gnu.org>2018-10-01 12:58:21 +0000
commit2c25083e75fa265fd6cdd749a264951dc002d90b (patch)
tree8cf97b47c2d4d4f0fe2f01f8522b89b2afe0cab9 /gcc/doc/tm.texi
parenteb471ba379597d73fcd79986cca5b8351a32770a (diff)
downloadgcc-2c25083e75fa265fd6cdd749a264951dc002d90b.zip
gcc-2c25083e75fa265fd6cdd749a264951dc002d90b.tar.gz
gcc-2c25083e75fa265fd6cdd749a264951dc002d90b.tar.bz2
Add a hook to support telling the mid-end when to probe the stack.
This patch adds a hook to tell the mid-end about the probing requirements of the target. On AArch64 we allow a specific range for which no probing needs to be done. This same range is also the amount that will have to be probed up when a probe is needed after dropping the stack. Defining this probe comes with the extra requirement that the outgoing arguments size of any function that uses alloca and stack clash be at the very least 8 bytes. With this invariant we can skip doing the zero checks for alloca and save some code. A simplified version of the AArch64 stack frame is: +-----------------------+ | | | | | | +-----------------------+ |LR | +-----------------------+ |FP | +-----------------------+ |dynamic allocations | -\ probe range hook effects these +-----------------------+ --\ and ensures that outgoing stack |padding | -- args is always > 8 when alloca. +-----------------------+ ---/ Which means it's always safe to probe |outgoing stack args |-/ at SP +-----------------------+ This allows us to generate better code than without the hook without affecting other targets. With this patch I am also removing the stack_clash_protection_final_dynamic_probe hook which was added specifically for AArch64 but that is no longer needed. gcc/ PR target/86486 * explow.c (anti_adjust_stack_and_probe_stack_clash): Support custom probe ranges. * target.def (stack_clash_protection_alloca_probe_range): New. (stack_clash_protection_final_dynamic_probe): Remove. * targhooks.h (default_stack_clash_protection_alloca_probe_range) New. (default_stack_clash_protection_final_dynamic_probe): Remove. * targhooks.c: Likewise. * doc/tm.texi.in (TARGET_STACK_CLASH_PROTECTION_ALLOCA_PROBE_RANGE): New. (TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE): Remove. * doc/tm.texi: Regenerate. From-SVN: r264750
Diffstat (limited to 'gcc/doc/tm.texi')
-rw-r--r--gcc/doc/tm.texi8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 561bda3..b00e4b6 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -3450,8 +3450,12 @@ GCC computed the default from the values of the above macros and you will
normally not need to override that default.
@end defmac
-@deftypefn {Target Hook} bool TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE (rtx @var{residual})
-Some targets make optimistic assumptions about the state of stack probing when they emit their prologues. On such targets a probe into the end of any dynamically allocated space is likely required for safety against stack clash style attacks. Define this variable to return nonzero if such a probe is required or zero otherwise. You need not define this macro if it would always have the value zero.
+@deftypefn {Target Hook} HOST_WIDE_INT TARGET_STACK_CLASH_PROTECTION_ALLOCA_PROBE_RANGE (void)
+Some targets have an ABI defined interval for which no probing needs to be done.
+When a probe does need to be done this same interval is used as the probe distance up when doing stack clash protection for alloca.
+On such targets this value can be set to override the default probing up interval.
+Define this variable to return nonzero if such a probe range is required or zero otherwise. Defining this hook also requires your functions which make use of alloca to have at least 8 byesof outgoing arguments. If this is not the case the stack will be corrupted.
+You need not define this macro if it would always have the value zero.
@end deftypefn
@need 2000