summaryrefslogtreecommitdiff
path: root/include/fortify-headers.h
diff options
context:
space:
mode:
authorjvoisin2023-03-18 14:01:02 +0100
committerjvoisin2023-04-13 23:48:57 +0200
commit3e6704d0be707487d7a9dccfdc75203c7261e11b (patch)
treecd04ae414fa7ef646a31f767b9295946fd2c9987 /include/fortify-headers.h
parente3fee64643279c144efd3d6856ed4e818c0d5ca2 (diff)
Make use of __builtin_dynamic_object_size
GCC and Clang provide __builtin_dynamic_object_size (see documentation: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html), so we should make use of it when its available.
Diffstat (limited to 'include/fortify-headers.h')
-rw-r--r--include/fortify-headers.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/fortify-headers.h b/include/fortify-headers.h
index 4de5bef..a37cd4a 100644
--- a/include/fortify-headers.h
+++ b/include/fortify-headers.h
@@ -21,4 +21,12 @@
21#define _FORTIFY_FN(fn) _FORTIFY_ORIG(__USER_LABEL_PREFIX__,fn); \ 21#define _FORTIFY_FN(fn) _FORTIFY_ORIG(__USER_LABEL_PREFIX__,fn); \
22 extern __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__)) 22 extern __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__))
23 23
24
25/* Use __builtin_dynamic_object_size with _FORTIFY_SOURCE>2, if available. */
26#if _FORTIFY_SOURCE > 2 && defined __has_builtin && __has_builtin (__builtin_dynamic_object_size)
27#define __bos(ptr, type) __builtin_dynamic_object_size (ptr, type)
28#else
29#define __bos(ptr, type) __builtin_object_size (ptr, type)
30#endif
31
24#endif 32#endif