diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 49a5686..6dd7351 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -17708,7 +17708,7 @@
 (define_expand "stack_protect_set"
   [(match_operand 0 "memory_operand")
    (match_operand 1 "memory_operand")]
-  ""
+  "!TARGET_HAS_BIONIC"
 {
   rtx (*insn)(rtx, rtx);
 
@@ -17733,7 +17733,7 @@
 		    UNSPEC_SP_SET))
    (set (match_scratch:PTR 2 "=&r") (const_int 0))
    (clobber (reg:CC FLAGS_REG))]
-  ""
+  "!TARGET_HAS_BIONIC"
   "mov{<imodesuffix>}\t{%1, %2|%2, %1}\;mov{<imodesuffix>}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"
   [(set_attr "type" "multi")])
 
@@ -17751,7 +17751,7 @@
   [(match_operand 0 "memory_operand")
    (match_operand 1 "memory_operand")
    (match_operand 2)]
-  ""
+  "!TARGET_HAS_BIONIC"
 {
   rtx flags = gen_rtx_REG (CCZmode, FLAGS_REG);
 
@@ -17781,7 +17781,7 @@
 		     (match_operand:PTR 2 "memory_operand" "m")]
 		    UNSPEC_SP_TEST))
    (clobber (match_scratch:PTR 3 "=&r"))]
-  ""
+  "!TARGET_HAS_BIONIC"
   "mov{<imodesuffix>}\t{%1, %3|%3, %1}\;xor{<imodesuffix>}\t{%2, %3|%3, %2}"
   [(set_attr "type" "multi")])
 
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index dbbeea5..fb459e6 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -104,3 +104,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 /* Whether we have sincos that follows the GNU extension.  */
 #undef TARGET_HAS_SINCOS
 #define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
+
+/* Whether we have Bionic libc runtime */
+#undef TARGET_HAS_BIONIC
+#define TARGET_HAS_BIONIC (OPTION_BIONIC)
diff --git a/gcc/defaults.h b/gcc/defaults.h
index cfd44ba..316a1c3 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1054,6 +1054,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define TARGET_HAS_SINCOS 0
 #endif
 
+/* Determin whether the target runtime library is Bionic */
+#ifndef TARGET_HAS_BIONIC
+#define TARGET_HAS_BIONIC 0
+#endif
+
 /* Indicate that CLZ and CTZ are undefined at zero.  */
 #ifndef CLZ_DEFINED_VALUE_AT_ZERO
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  0
