diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-12-11 19:15:17 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2013-12-11 19:15:17 +0000 |
commit | f47316b8dceb7d94c3e7501c82543148994220fa (patch) | |
tree | f1ccf23cb539ae348809a31476cb48bb5df5798f /gnu | |
parent | 5265058cfff12ffeb74ff4548f541e28ec02c2e9 (diff) |
Revert the previous commit; this is not the right approach.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/gcc/gcc/builtins.c | 6 | ||||
-rw-r--r-- | gnu/gcc/gcc/builtins.def | 10 | ||||
-rw-r--r-- | gnu/gcc/gcc/config/openbsd.h | 6 |
3 files changed, 17 insertions, 5 deletions
diff --git a/gnu/gcc/gcc/builtins.c b/gnu/gcc/gcc/builtins.c index 2c3ef0304d8..44e40813f9b 100644 --- a/gnu/gcc/gcc/builtins.c +++ b/gnu/gcc/gcc/builtins.c @@ -5933,9 +5933,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, break; case BUILT_IN_STRCPY: +#ifndef NO_UNSAFE_BUILTINS target = expand_builtin_strcpy (fndecl, arglist, target, mode); if (target) return target; +#endif break; case BUILT_IN_STRNCPY: @@ -5945,15 +5947,19 @@ 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: +#ifndef NO_UNSAFE_BUILTINS target = expand_builtin_strcat (fndecl, arglist, target, mode); if (target) return target; +#endif break; case BUILT_IN_STRNCAT: diff --git a/gnu/gcc/gcc/builtins.def b/gnu/gcc/gcc/builtins.def index c550b06d8f8..fd8713c4fa3 100644 --- a/gnu/gcc/gcc/builtins.def +++ b/gnu/gcc/gcc/builtins.def @@ -502,13 +502,13 @@ DEF_LIB_BUILTIN (BUILT_IN_MEMMOVE, "memmove", BT_FN_PTR_PTR_CONST_PTR_SIZ DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMPCPY, "mempcpy", BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_NOTHROW_NONNULL) DEF_LIB_BUILTIN (BUILT_IN_MEMSET, "memset", BT_FN_PTR_PTR_INT_SIZE, ATTR_NOTHROW_NONNULL_BOUNDED_BUFFER_1_3) DEF_EXT_LIB_BUILTIN (BUILT_IN_RINDEX, "rindex", BT_FN_STRING_CONST_STRING_INT, ATTR_PURE_NOTHROW_NONNULL) -DEF_GCC_BUILTIN (BUILT_IN_STPCPY, "stpcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL) +DEF_EXT_LIB_BUILTIN (BUILT_IN_STPCPY, "stpcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL) DEF_EXT_LIB_BUILTIN (BUILT_IN_STPNCPY, "stpncpy", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL) DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCASECMP, "strcasecmp", BT_FN_INT_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL) -DEF_GCC_BUILTIN (BUILT_IN_STRCAT, "strcat", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL) +DEF_LIB_BUILTIN (BUILT_IN_STRCAT, "strcat", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL) DEF_LIB_BUILTIN (BUILT_IN_STRCHR, "strchr", BT_FN_STRING_CONST_STRING_INT, ATTR_PURE_NOTHROW_NONNULL) DEF_LIB_BUILTIN (BUILT_IN_STRCMP, "strcmp", BT_FN_INT_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL) -DEF_GCC_BUILTIN (BUILT_IN_STRCPY, "strcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL) +DEF_LIB_BUILTIN (BUILT_IN_STRCPY, "strcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL) DEF_LIB_BUILTIN (BUILT_IN_STRCSPN, "strcspn", BT_FN_SIZE_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL) DEF_EXT_LIB_BUILTIN (BUILT_IN_STRDUP, "strdup", BT_FN_STRING_CONST_STRING, ATTR_MALLOC_NOTHROW_NONNULL) DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNDUP, "strndup", BT_FN_STRING_CONST_STRING_SIZE, ATTR_MALLOC_NOTHROW_NONNULL) @@ -542,14 +542,14 @@ DEF_LIB_BUILTIN (BUILT_IN_PUTS, "puts", BT_FN_INT_CONST_STRING, ATTR_NONN DEF_EXT_LIB_BUILTIN (BUILT_IN_PUTS_UNLOCKED, "puts_unlocked", BT_FN_INT_CONST_STRING, ATTR_NONNULL_LIST) DEF_LIB_BUILTIN (BUILT_IN_SCANF, "scanf", BT_FN_INT_CONST_STRING_VAR, ATTR_FORMAT_SCANF_1_2) DEF_C99_BUILTIN (BUILT_IN_SNPRINTF, "snprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VAR, ATTR_PRINTF_3_4_BOUNDED_STRING_1_2) -DEF_GCC_BUILTIN (BUILT_IN_SPRINTF, "sprintf", BT_FN_INT_STRING_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_2_3) +DEF_LIB_BUILTIN (BUILT_IN_SPRINTF, "sprintf", BT_FN_INT_STRING_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_2_3) DEF_LIB_BUILTIN (BUILT_IN_SSCANF, "sscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VAR, ATTR_FORMAT_SCANF_2_3) DEF_LIB_BUILTIN (BUILT_IN_VFPRINTF, "vfprintf", BT_FN_INT_FILEPTR_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_2_0) DEF_C99_BUILTIN (BUILT_IN_VFSCANF, "vfscanf", BT_FN_INT_FILEPTR_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_2_0) DEF_LIB_BUILTIN (BUILT_IN_VPRINTF, "vprintf", BT_FN_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_1_0) DEF_C99_BUILTIN (BUILT_IN_VSCANF, "vscanf", BT_FN_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_1_0) DEF_C99_BUILTIN (BUILT_IN_VSNPRINTF, "vsnprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG, ATTR_PRINTF_3_0_BOUNDED_STRING_1_2) -DEF_GCC_BUILTIN (BUILT_IN_VSPRINTF, "vsprintf", BT_FN_INT_STRING_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_2_0) +DEF_LIB_BUILTIN (BUILT_IN_VSPRINTF, "vsprintf", BT_FN_INT_STRING_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_2_0) DEF_C99_BUILTIN (BUILT_IN_VSSCANF, "vsscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_2_0) /* Category: ctype builtins. */ diff --git a/gnu/gcc/gcc/config/openbsd.h b/gnu/gcc/gcc/config/openbsd.h index e2cbd08a639..658c5e44265 100644 --- a/gnu/gcc/gcc/config/openbsd.h +++ b/gnu/gcc/gcc/config/openbsd.h @@ -343,6 +343,12 @@ __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 + /* The system headers on OpenBSD are C++-aware. */ #undef NO_IMPLICIT_EXTERN_C #define NO_IMPLICIT_EXTERN_C |