On Tue, Jan 17, 2017 at 12:43 PM, Segher Boessenkool
<seg...@kernel.crashing.org> wrote:
> Currently, on PowerPC, code compiled with -fstack-protector will load
> the canary from -0x7010(13) (for -m64) or from -0x7008(2) (for -m32)
> if GCC was compiled against GNU libc 2.4 or newer or some other libc
> that supports -fstack-protector, and from the global variable
> __stack_chk_guard otherwise.
>
> This does not work well for Linux and other OS kernels and similar.
> For such non-standard applications, this patch creates a few new
> command-line options.  The relevant new use cases are:
>
> -mstack-protector-guard=global
> Use the __stack_chk_guard variable, no matter how this GCC was
> configured.
>
> -mstack-protector-guard=tls
> Use the canary from TLS.  This will error out if this GCC was built
> with a C library that does not support it.
>
> -mstack-protector-guard=tls -mstack-protector-register=<reg>
> -mstack-protector-offset=<offset>
> Load the canary from offset <off> from base register <reg>.
>
>
> Bootstrap and test running.  Is this okay for trunk?
>
>
> Segher
>
>
> 2017-01-17  Segher Boessenkool  <seg...@kernel.crashing.org>
>
>         PR target/78875
>
>         * config/rs6000/rs6000-opts.h (stack_protector_guard): New enum.
>         * config/rs6000/rs6000.c (rs6000_option_override_internal): Handle
>         the new options.
>         * config/rs6000/rs6000.md (stack_protect_set): Handle the new more
>         flexible settings.
>         (stack_protect_test): Ditto.
>         * config/rs6000/rs6000.opt (mstack-protector-guard=,
>         mstack-protector-guard-reg=, mstack-protector-guard-offset=): New
>         options.
>         * doc/invoke.texi (Option Summary) [RS/6000 and PowerPC Options]:
>         Add -mstack-protector-guard=, -mstack-protector-guard-reg=, and
>         -mstack-protector-guard-offset=.
>         (RS/6000 and PowerPC Options): Ditto.
>
> gcc/testsuite/
>         * gcc.target/powerpc/ssp-1.c: New testcase.
>         * gcc.target/powerpc/ssp-2.c: New testcase.

Okay.

Thanks, David

Reply via email to