From: Richard Henderson Date: Thu, 4 Aug 2005 03:57:41 +0000 (-0700) Subject: re PR middle-end/23221 (-fstack-protector does not protect tail call functions) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b755446cef42521b9cbfbf4a3fe334db4d9054f2;p=gcc.git re PR middle-end/23221 (-fstack-protector does not protect tail call functions) PR 23221 * function.c (stack_protect_epilogue): Export. * tree.h (stack_protect_epilogue): Declare. * calls.c (expand_call): Call it. From-SVN: r102731 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index afeda5c2c6d..2a7ffc77f51 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-08-03 Richard Henderson + + PR 23221 + * function.c (stack_protect_epilogue): Export. + * tree.h (stack_protect_epilogue): Declare. + * calls.c (expand_call): Call it. + 2005-08-03 Eric Christopher * gcc.c (LINK_SSP_SPEC): Add fstack-protector-all. diff --git a/gcc/calls.c b/gcc/calls.c index d51fbf6331b..84e0db78c7f 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2247,6 +2247,9 @@ expand_call (tree exp, rtx target, int ignore) if (pass && (flags & (ECF_LIBCALL_BLOCK | ECF_MALLOC))) start_sequence (); + if (pass == 0 && cfun->stack_protect_guard) + stack_protect_epilogue (); + adjusted_args_size = args_size; /* Compute the actual size of the argument block required. The variable and constant sizes must be combined, the size may have to be rounded, diff --git a/gcc/function.c b/gcc/function.c index 2b4fe1bfc6c..225c2a98117 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4013,7 +4013,7 @@ stack_protect_prologue (void) # define gen_stack_protect_test(x, y, z) (gcc_unreachable (), NULL_RTX) #endif -static void +void stack_protect_epilogue (void) { tree guard_decl = targetm.stack_protect_guard (); diff --git a/gcc/tree.h b/gcc/tree.h index cae0c8b12d6..b6b637af9d5 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3908,6 +3908,7 @@ extern void dump_tree_statistics (void); extern void expand_function_end (void); extern void expand_function_start (tree); extern void stack_protect_prologue (void); +extern void stack_protect_epilogue (void); extern void recompute_tree_invarant_for_addr_expr (tree); extern bool is_global_var (tree t); extern bool needs_to_live_in_memory (tree);