re PR target/85644 (-fstack-protector generates invalid read to %fs:0x0 on mac)
authorJakub Jelinek <jakub@redhat.com>
Thu, 22 Nov 2018 09:48:43 +0000 (10:48 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 22 Nov 2018 09:48:43 +0000 (10:48 +0100)
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

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index 2ae6ce71c1089890dd7d7610d9a2888eac6f09f2..98993207d32e133404ed88c451d76d8ea2dc9d87 100644 (file)
@@ -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
index edf6dcfb4412591251f87be67e4777ad8376db19..21eb6a2d42c7122fd73d0d3e2e6ff7a4666bb023 100644 (file)
@@ -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;
index 2231204b29c148478f32531ce856246dba82920e..37a92f5bb30bf6fe1450234b647b8ab5f38de6af 100644 (file)
 (define_expand "stack_protect_set"
   [(match_operand 0 "memory_operand")
    (match_operand 1 "memory_operand")]
-  "TARGET_SSP_TLS_GUARD"
+  ""
 {
   rtx (*insn)(rtx, rtx);
 
                    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")])
 
   [(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);
 
                     (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")])