diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-11-22 10:48:43 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-11-22 10:48:43 +0100 |
commit | e15bac63bad1cae4efa93f9b783e0397bca13f1d (patch) | |
tree | 16f84a2eaae3e50edd7edaf71d476d8a32f9e834 /gcc | |
parent | 3bcd988251e21dbc5bc6617b1c67aad6cf24a465 (diff) | |
download | gcc-e15bac63bad1cae4efa93f9b783e0397bca13f1d.zip gcc-e15bac63bad1cae4efa93f9b783e0397bca13f1d.tar.gz gcc-e15bac63bad1cae4efa93f9b783e0397bca13f1d.tar.bz2 |
re PR target/85644 (-fstack-protector generates invalid read to %fs:0x0 on mac)
PR target/85644
PR target/86832
* config/i386/i386.c (ix86_option_override_internal): Default
ix86_stack_protector_guard to SSP_TLS only if TARGET_THREAD_SSP_OFFSET
is defined.
* config/i386/i386.md (stack_protect_set, stack_protect_set_<mode>,
stack_protect_test, stack_protect_test_<mode>): Use empty condition
instead of TARGET_SSP_TLS_GUARD.
From-SVN: r266370
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 10 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 8 |
3 files changed, 23 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ae6ce7..9899320 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2018-11-22 Jakub Jelinek <jakub@redhat.com> + + PR target/85644 + PR target/86832 + * config/i386/i386.c (ix86_option_override_internal): Default + ix86_stack_protector_guard to SSP_TLS only if TARGET_THREAD_SSP_OFFSET + is defined. + * config/i386/i386.md (stack_protect_set, stack_protect_set_<mode>, + stack_protect_test, stack_protect_test_<mode>): Use empty condition + instead of TARGET_SSP_TLS_GUARD. + 2018-11-22 Martin Liska <mliska@suse.cz> PR sanitizer/88017 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index edf6dcf..21eb6a2 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4559,8 +4559,14 @@ ix86_option_override_internal (bool main_args_p, /* Handle stack protector */ if (!opts_set->x_ix86_stack_protector_guard) - opts->x_ix86_stack_protector_guard - = TARGET_HAS_BIONIC ? SSP_GLOBAL : SSP_TLS; + { +#ifdef TARGET_THREAD_SSP_OFFSET + if (!TARGET_HAS_BIONIC) + opts->x_ix86_stack_protector_guard = SSP_TLS; + else +#endif + opts->x_ix86_stack_protector_guard = SSP_GLOBAL; + } #ifdef TARGET_THREAD_SSP_OFFSET ix86_stack_protector_guard_offset = TARGET_THREAD_SSP_OFFSET; diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 2231204..37a92f5 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -19010,7 +19010,7 @@ (define_expand "stack_protect_set" [(match_operand 0 "memory_operand") (match_operand 1 "memory_operand")] - "TARGET_SSP_TLS_GUARD" + "" { rtx (*insn)(rtx, rtx); @@ -19028,7 +19028,7 @@ UNSPEC_SP_SET)) (set (match_scratch:PTR 2 "=&r") (const_int 0)) (clobber (reg:CC FLAGS_REG))] - "TARGET_SSP_TLS_GUARD" + "" "mov{<imodesuffix>}\t{%1, %2|%2, %1}\;mov{<imodesuffix>}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2" [(set_attr "type" "multi")]) @@ -19036,7 +19036,7 @@ [(match_operand 0 "memory_operand") (match_operand 1 "memory_operand") (match_operand 2)] - "TARGET_SSP_TLS_GUARD" + "" { rtx flags = gen_rtx_REG (CCZmode, FLAGS_REG); @@ -19059,7 +19059,7 @@ (match_operand:PTR 2 "memory_operand" "m")] UNSPEC_SP_TEST)) (clobber (match_scratch:PTR 3 "=&r"))] - "TARGET_SSP_TLS_GUARD" + "" "mov{<imodesuffix>}\t{%1, %3|%3, %1}\;xor{<imodesuffix>}\t{%2, %3|%3, %2}" [(set_attr "type" "multi")]) |