summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2004-07-20 20:47:31 +0000
committermiod <miod@openbsd.org>2004-07-20 20:47:31 +0000
commit19064bd8ec9a5b64f7bf7a85b61a5bd012fa2d6c (patch)
tree541391de812f63bd0cbf867f94cd6c2ad18191ee
parentadd cdce (diff)
downloadwireguard-openbsd-19064bd8ec9a5b64f7bf7a85b61a5bd012fa2d6c.tar.xz
wireguard-openbsd-19064bd8ec9a5b64f7bf7a85b61a5bd012fa2d6c.zip
Do not provide builtins for strcpy() and strcat(), as done with gcc 2, on
the sole purpose of making these easier to spot and exterminate. tested by various people on amd64 and I on arm&sparc64, ok deraadt@
-rw-r--r--gnu/usr.bin/gcc/gcc/builtins.c4
-rw-r--r--gnu/usr.bin/gcc/gcc/config/openbsd.h5
2 files changed, 9 insertions, 0 deletions
diff --git a/gnu/usr.bin/gcc/gcc/builtins.c b/gnu/usr.bin/gcc/gcc/builtins.c
index e0c8ce04601..b0ca7105aff 100644
--- a/gnu/usr.bin/gcc/gcc/builtins.c
+++ b/gnu/usr.bin/gcc/gcc/builtins.c
@@ -3906,9 +3906,11 @@ expand_builtin (exp, target, subtarget, mode, ignore)
break;
case BUILT_IN_STRCPY:
+#ifndef NO_UNSAFE_BUILTINS
target = expand_builtin_strcpy (exp, target, mode);
if (target)
return target;
+#endif
break;
case BUILT_IN_STRNCPY:
@@ -3918,9 +3920,11 @@ expand_builtin (exp, target, subtarget, mode, ignore)
break;
case BUILT_IN_STRCAT:
+#ifndef NO_UNSAFE_BUILTINS
target = expand_builtin_strcat (arglist, target, mode);
if (target)
return target;
+#endif
break;
case BUILT_IN_STRNCAT:
diff --git a/gnu/usr.bin/gcc/gcc/config/openbsd.h b/gnu/usr.bin/gcc/gcc/config/openbsd.h
index bf37f77a864..b6daf8521f0 100644
--- a/gnu/usr.bin/gcc/gcc/config/openbsd.h
+++ b/gnu/usr.bin/gcc/gcc/config/openbsd.h
@@ -314,3 +314,8 @@ do { \
work. On the other hand, we don't define HANDLE_PRAGMA_WEAK directly,
as this depends on a few other details as well... */
#define HANDLE_SYSV_PRAGMA 1
+
+/* Disable the use of unsafe builtin functions, (strcat, strcpy), making
+ * them easier to spot in the object files.
+ */
+#define NO_UNSAFE_BUILTINS