$OpenBSD: patch-gcc_builtins_c,v 1.2 2015/07/19 21:22:49 pascal Exp $
--- gcc/builtins.c.orig	Fri Feb 27 11:32:14 2015
+++ gcc/builtins.c	Sat Jun 27 11:26:32 2015
@@ -125,9 +125,11 @@ static rtx expand_builtin_memcpy (tree, rtx);
 static rtx expand_builtin_mempcpy (tree, rtx, enum machine_mode);
 static rtx expand_builtin_mempcpy_args (tree, tree, tree, rtx,
 					enum machine_mode, int);
+#ifndef NO_UNSAFE_BUILTINS
 static rtx expand_builtin_strcpy (tree, rtx);
 static rtx expand_builtin_strcpy_args (tree, tree, rtx);
 static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode);
+#endif
 static rtx expand_builtin_strncpy (tree, rtx);
 static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode);
 static rtx expand_builtin_memset (tree, rtx, enum machine_mode);
@@ -3375,6 +3377,7 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree
 # define CODE_FOR_movstr CODE_FOR_nothing
 #endif
 
+#ifndef NO_UNSAFE_BUILTINS
 /* Expand into a movstr instruction, if one is available.  Return NULL_RTX if
    we failed, the caller should emit a normal call, otherwise try to
    get the result in TARGET, if convenient.  If ENDP is 0 return the
@@ -3526,6 +3529,7 @@ expand_builtin_stpcpy (tree exp, rtx target, enum mach
       return expand_movstr (dst, src, target, /*endp=*/2);
     }
 }
+#endif
 
 /* Callback routine for store_by_pieces.  Read GET_MODE_BITSIZE (MODE)
    bytes from constant string DATA + OFFSET and return it as target
@@ -6145,9 +6149,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, e
       break;
 
     case BUILT_IN_STRCPY:
+#ifndef NO_UNSAFE_BUILTINS
       target = expand_builtin_strcpy (exp, target);
       if (target)
 	return target;
+#endif
       break;
 
     case BUILT_IN_STRNCPY:
@@ -6157,9 +6163,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, e
       break;
 
     case BUILT_IN_STPCPY:
+#ifndef NO_UNSAFE_BUILTINS
       target = expand_builtin_stpcpy (exp, target, mode);
       if (target)
 	return target;
+#endif
       break;
 
     case BUILT_IN_MEMCPY:
