summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Stumpf <pascal@cvs.openbsd.org>2012-03-06 09:51:49 +0000
committerPascal Stumpf <pascal@cvs.openbsd.org>2012-03-06 09:51:49 +0000
commit6ec15e5f0b6c1af16893d8090af944bf76bff713 (patch)
treef09817cc0a0b28874e4f208baae14870957c7fa5
parente1ea139700f073ceb20eb993eed66e3ae4dd4fc9 (diff)
Define NO_UNSAFE_BUILTINS, overlooked when local changes got merged to gcc4.
Found by Brad. Also, consider stpcpy an unsafe builtin and prevent it from being optimised away. ok miod@
-rw-r--r--gnu/gcc/gcc/builtins.c2
-rw-r--r--gnu/gcc/gcc/config/openbsd.h6
2 files changed, 8 insertions, 0 deletions
diff --git a/gnu/gcc/gcc/builtins.c b/gnu/gcc/gcc/builtins.c
index 7a927d2d6da..44e40813f9b 100644
--- a/gnu/gcc/gcc/builtins.c
+++ b/gnu/gcc/gcc/builtins.c
@@ -5947,9 +5947,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
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_STRCAT:
diff --git a/gnu/gcc/gcc/config/openbsd.h b/gnu/gcc/gcc/config/openbsd.h
index 3f4a50c6493..e9af56e398e 100644
--- a/gnu/gcc/gcc/config/openbsd.h
+++ b/gnu/gcc/gcc/config/openbsd.h
@@ -343,5 +343,11 @@ __enable_execute_stack (void *addr) \
perror ("mprotect of trampoline code"); \
}
+/*
+ * Disable the use of unsafe builtin functions, (strcat, strcpy, stpcpy),
+ * making them easier to spot in the object files.
+ */
+#define NO_UNSAFE_BUILTINS
+
#include <sys/types.h>
#include <sys/mman.h>