summaryrefslogtreecommitdiff
path: root/include/fortify-headers.h
diff options
context:
space:
mode:
authorjvoisin2023-08-20 19:02:03 +0200
committerjvoisin2023-08-20 20:51:19 +0200
commitbc50ed6c3de76c11b2dde92d0f28dd45941fc327 (patch)
tree7cedd350931edc1ebcd23aeefd8cce3a8750c7a8 /include/fortify-headers.h
parentc17d47669ff12057f732f9ae3f69b22d52b4c6b5 (diff)
Fix clang build
- s/CLFAGS/CFLAGS/ - provide paths to local includes - sprinkle more __pass_object_size__ - remove a problematic test
Diffstat (limited to 'include/fortify-headers.h')
-rw-r--r--include/fortify-headers.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/fortify-headers.h b/include/fortify-headers.h
index dde19a2..18d302b 100644
--- a/include/fortify-headers.h
+++ b/include/fortify-headers.h
@@ -25,7 +25,7 @@
25#ifdef __clang__ 25#ifdef __clang__
26 26
27/* clang uses overloads; see https://github.com/llvm/llvm-project/issues/53516 */ 27/* clang uses overloads; see https://github.com/llvm/llvm-project/issues/53516 */
28#define _FORTIFY_POSN(n) const __attribute__((__pass_object_size__(n))) 28#define _FORTIFY_POSN(n) const __attribute__((pass_object_size(n)))
29/* we can't use extern inline with overloads without making them external */ 29/* we can't use extern inline with overloads without making them external */
30#define _FORTIFY_INLINE static __inline__ \ 30#define _FORTIFY_INLINE static __inline__ \
31 __attribute__((__always_inline__,__artificial__,__overloadable__)) 31 __attribute__((__always_inline__,__artificial__,__overloadable__))
@@ -38,6 +38,7 @@
38 38
39#endif /* __clang__ */ 39#endif /* __clang__ */
40 40
41/* https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html */
41#define _FORTIFY_POS0 _FORTIFY_POSN(0) 42#define _FORTIFY_POS0 _FORTIFY_POSN(0)
42#define _FORTIFY_POS1 _FORTIFY_POSN(1) 43#define _FORTIFY_POS1 _FORTIFY_POSN(1)
43#define _FORTIFY_POS2 _FORTIFY_POSN(2) 44#define _FORTIFY_POS2 _FORTIFY_POSN(2)
@@ -47,7 +48,6 @@
47#define _FORTIFY_FNB(fn) _FORTIFY_ORIG(__USER_LABEL_PREFIX__,fn) 48#define _FORTIFY_FNB(fn) _FORTIFY_ORIG(__USER_LABEL_PREFIX__,fn)
48#define _FORTIFY_FN(fn) _FORTIFY_FNB(fn); _FORTIFY_INLINE 49#define _FORTIFY_FN(fn) _FORTIFY_FNB(fn); _FORTIFY_INLINE
49 50
50
51/* Use __builtin_dynamic_object_size with _FORTIFY_SOURCE>2, if available. */ 51/* Use __builtin_dynamic_object_size with _FORTIFY_SOURCE>2, if available. */
52#if _FORTIFY_SOURCE > 2 && __has_builtin (__builtin_dynamic_object_size) 52#if _FORTIFY_SOURCE > 2 && __has_builtin (__builtin_dynamic_object_size)
53/* 53/*
@@ -73,7 +73,11 @@
73#endif 73#endif
74 74
75#if __has_attribute (malloc) 75#if __has_attribute (malloc)
76#ifdef __clang__
77#define __malloc(...) __attribute__ ((malloc))
78#else
76#define __malloc(...) __attribute__ ((malloc, __VA_ARGS__)) 79#define __malloc(...) __attribute__ ((malloc, __VA_ARGS__))
80#endif /* __clang__ */
77#else 81#else
78#define __malloc(...) 82#define __malloc(...)
79#endif 83#endif