Message ID | c25a3784dd29348b418904777d3bc5163342b884.1484866680.git.segher@kernel.crashing.org |
---|---|
State | New |
Headers | show |
On Thu, Jan 19, 2017 at 6:00 PM, Segher Boessenkool <segher@kernel.crashing.org> wrote: > I foolishly tested this with r241087 reverted. After that revision > default_stack_protect_guard is no longer called if the compiler defaults > to using the TLS guard, which of course is the wrong thing to do if > there is some other way to enable the global guard. > > This fixes it. > > Is this okay for trunk? Tested on powerpc64-linux {-m32,-m64}; also > will test on powerpc64le-linux. > > > Segher > > > 2017-01-19 Segher Boessenkool <segher@kernel.crashing.org> > > PR target/79140 > * rs6000.c (TARGET_STACK_PROTECT_GUARD): Unconditionally define to > rs6000_init_stack_protect_guard. > (rs6000_init_stack_protect_guard): New function. Okay. Thanks, David
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 230e52a..db1145d 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1759,10 +1759,8 @@ static const struct attribute_spec rs6000_attribute_table[] = #define TARGET_VECTORIZE_BUILTIN_MD_VECTORIZED_FUNCTION \ rs6000_builtin_md_vectorized_function -#ifdef TARGET_THREAD_SSP_OFFSET #undef TARGET_STACK_PROTECT_GUARD -#define TARGET_STACK_PROTECT_GUARD hook_tree_void_null -#endif +#define TARGET_STACK_PROTECT_GUARD rs6000_init_stack_protect_guard #if !TARGET_MACHO #undef TARGET_STACK_PROTECT_FAIL @@ -9480,6 +9478,17 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model) return dest; } +/* Only create the global variable for the stack protect guard if we are using + the global flavor of that guard. */ +static tree +rs6000_init_stack_protect_guard (void) +{ + if (rs6000_stack_protector_guard == SSP_GLOBAL) + return default_stack_protect_guard (); + + return NULL_TREE; +} + /* Implement TARGET_CANNOT_FORCE_CONST_MEM. */ static bool