fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers
Log | Files | Refs | README | LICENSE

commit d6afda7207b7a8a144923ab5813d8a0816813907
parent c29287d01bceb0a54996be1e138f2e7f62917907
Author: jvoisin <julien.voisin@dustri.org>
Date:   Sun, 20 Aug 2023 20:43:55 +0200

Use pass_dynamic_object_size only for FORTIFY_SOURCE > 2

Diffstat:
Minclude/fortify-headers.h | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/fortify-headers.h b/include/fortify-headers.h @@ -24,12 +24,13 @@ #ifdef __clang__ -/* clang uses overloads; see https://github.com/llvm/llvm-project/issues/53516 */ -#if __has_attribute(pass_dynamic_object_size) +#if _FORTIFY_SOURCE > 2 && __has_builtin (__builtin_dynamic_object_size) && __has_attribute(pass_dynamic_object_size) #define _FORTIFY_POSN(n) const __attribute__((pass_dynamic_object_size(n))) #else #define _FORTIFY_POSN(n) const __attribute__((pass_object_size(n))) -#endif /* pass_dynamic_object_size) */ +#endif /* __builtin_dynamic_object_size && pass_dynamic_object_size */ + +/* clang uses overloads; see https://github.com/llvm/llvm-project/issues/53516 */ /* we can't use extern inline with overloads without making them external */ #define _FORTIFY_INLINE static __inline__ \ __attribute__((__always_inline__,__artificial__,__overloadable__))