patch-gcc_builtins_c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. $OpenBSD: patch-gcc_builtins_c,v 1.2 2015/07/19 21:22:49 pascal Exp $
  2. --- gcc/builtins.c.orig Fri Feb 27 11:32:14 2015
  3. +++ gcc/builtins.c Sat Jun 27 11:26:32 2015
  4. @@ -125,9 +125,11 @@ static rtx expand_builtin_memcpy (tree, rtx);
  5. static rtx expand_builtin_mempcpy (tree, rtx, enum machine_mode);
  6. static rtx expand_builtin_mempcpy_args (tree, tree, tree, rtx,
  7. enum machine_mode, int);
  8. +#ifndef NO_UNSAFE_BUILTINS
  9. static rtx expand_builtin_strcpy (tree, rtx);
  10. static rtx expand_builtin_strcpy_args (tree, tree, rtx);
  11. static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode);
  12. +#endif
  13. static rtx expand_builtin_strncpy (tree, rtx);
  14. static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode);
  15. static rtx expand_builtin_memset (tree, rtx, enum machine_mode);
  16. @@ -3375,6 +3377,7 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree
  17. # define CODE_FOR_movstr CODE_FOR_nothing
  18. #endif
  19. +#ifndef NO_UNSAFE_BUILTINS
  20. /* Expand into a movstr instruction, if one is available. Return NULL_RTX if
  21. we failed, the caller should emit a normal call, otherwise try to
  22. get the result in TARGET, if convenient. If ENDP is 0 return the
  23. @@ -3526,6 +3529,7 @@ expand_builtin_stpcpy (tree exp, rtx target, enum mach
  24. return expand_movstr (dst, src, target, /*endp=*/2);
  25. }
  26. }
  27. +#endif
  28. /* Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE)
  29. bytes from constant string DATA + OFFSET and return it as target
  30. @@ -6145,9 +6149,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, e
  31. break;
  32. case BUILT_IN_STRCPY:
  33. +#ifndef NO_UNSAFE_BUILTINS
  34. target = expand_builtin_strcpy (exp, target);
  35. if (target)
  36. return target;
  37. +#endif
  38. break;
  39. case BUILT_IN_STRNCPY:
  40. @@ -6157,9 +6163,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, e
  41. break;
  42. case BUILT_IN_STPCPY:
  43. +#ifndef NO_UNSAFE_BUILTINS
  44. target = expand_builtin_stpcpy (exp, target, mode);
  45. if (target)
  46. return target;
  47. +#endif
  48. break;
  49. case BUILT_IN_MEMCPY: