ssp.h.in 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Object size checking support macros.
  2. Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. In addition to the permissions in the GNU General Public License, the
  9. Free Software Foundation gives you unlimited permission to link the
  10. compiled version of this file into combinations with other programs,
  11. and to distribute those combinations without any restriction coming
  12. from the use of this file. (The General Public License restrictions
  13. do apply in other respects; for example, they cover modification of
  14. the file, and distribution when not linked into a combine
  15. executable.)
  16. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  17. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  18. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  19. for more details.
  20. Under Section 7 of GPL version 3, you are granted additional
  21. permissions described in the GCC Runtime Library Exception, version
  22. 3.1, as published by the Free Software Foundation.
  23. You should have received a copy of the GNU General Public License and
  24. a copy of the GCC Runtime Library Exception along with this program;
  25. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  26. <http://www.gnu.org/licenses/>. */
  27. #ifndef _SSP_H
  28. #define _SSP_H 1
  29. #if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 \
  30. && defined __GNUC__ \
  31. && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
  32. && !defined __cplusplus
  33. # if _FORTIFY_SOURCE == 1
  34. # define __SSP_FORTIFY_LEVEL 1
  35. # elif _FORTIFY_SOURCE > 1
  36. # define __SSP_FORTIFY_LEVEL 2
  37. # endif
  38. #endif
  39. #if __SSP_FORTIFY_LEVEL > 0
  40. # include <stddef.h>
  41. # define __ssp_bos(ptr) __builtin_object_size (ptr, __SSP_FORTIFY_LEVEL > 1)
  42. # define __ssp_bos0(ptr) __builtin_object_size (ptr, 0)
  43. # define __SSP_REDIRECT(name, proto, alias) \
  44. name proto __asm__ (__SSP_ASMNAME (#alias))
  45. # define __SSP_ASMNAME(cname) __SSP_ASMNAME2 (__USER_LABEL_PREFIX__, cname)
  46. # define __SSP_ASMNAME2(prefix, cname) __SSP_ASMNAME3 (prefix) cname
  47. # define __SSP_ASMNAME3(prefix) #prefix
  48. # @ssp_have_usable_vsnprintf@ __SSP_HAVE_VSNPRINTF
  49. extern void __chk_fail (void) __attribute__((__noreturn__));
  50. #endif
  51. #endif /* _SSP_H */