|
|
c5d972 |
commit 86bf0feb0e3ec8e37872f72499d6ae33406561d7
|
|
|
c5d972 |
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
c5d972 |
Date: Wed Jan 12 18:46:28 2022 +0530
|
|
|
c5d972 |
|
|
|
c5d972 |
Enable _FORTIFY_SOURCE=3 for gcc 12 and above
|
|
|
c5d972 |
|
|
|
c5d972 |
gcc 12 now has support for the __builtin_dynamic_object_size builtin.
|
|
|
c5d972 |
Adapt the macro checks to enable _FORTIFY_SOURCE=3 on gcc 12 and above.
|
|
|
c5d972 |
|
|
|
c5d972 |
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
c5d972 |
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
c5d972 |
|
|
|
c5d972 |
diff --git a/include/features.h b/include/features.h
|
|
|
c5d972 |
index fe9fe16d034fad1b..2e9ca6ec2f4a0380 100644
|
|
|
c5d972 |
--- a/include/features.h
|
|
|
c5d972 |
+++ b/include/features.h
|
|
|
c5d972 |
@@ -381,7 +381,9 @@
|
|
|
c5d972 |
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
|
|
|
c5d972 |
# elif !__GNUC_PREREQ (4, 1)
|
|
|
c5d972 |
# warning _FORTIFY_SOURCE requires GCC 4.1 or later
|
|
|
c5d972 |
-# elif _FORTIFY_SOURCE > 2 && __glibc_clang_prereq (9, 0)
|
|
|
c5d972 |
+# elif _FORTIFY_SOURCE > 2 && (__glibc_clang_prereq (9, 0) \
|
|
|
c5d972 |
+ || __GNUC_PREREQ (12, 0))
|
|
|
c5d972 |
+
|
|
|
c5d972 |
# if _FORTIFY_SOURCE > 3
|
|
|
c5d972 |
# warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform
|
|
|
c5d972 |
# endif
|
|
|
c5d972 |
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
|
|
|
c5d972 |
index 147339957c4ad490..a17ae0ed87e6163f 100644
|
|
|
c5d972 |
--- a/misc/sys/cdefs.h
|
|
|
c5d972 |
+++ b/misc/sys/cdefs.h
|
|
|
c5d972 |
@@ -124,7 +124,8 @@
|
|
|
c5d972 |
#define __bos0(ptr) __builtin_object_size (ptr, 0)
|
|
|
c5d972 |
|
|
|
c5d972 |
/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
|
|
|
c5d972 |
-#if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0)
|
|
|
c5d972 |
+#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \
|
|
|
c5d972 |
+ || __GNUC_PREREQ (12, 0))
|
|
|
c5d972 |
# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
|
|
|
c5d972 |
# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
|
|
|
c5d972 |
#else
|