[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] build: Don't add _FORTIFY_SOURCE if already set by user/toolchai
From: |
Sam James |
Subject: |
[PATCH] build: Don't add _FORTIFY_SOURCE if already set by user/toolchain |
Date: |
Mon, 9 Jan 2023 08:04:31 +0000 |
Newer toolchains (GCC 12+ or Clang 9+, glibc-2.34) allow _FORTIFY_SOURCE=3.
The current macro used in configure.ac will forcefully downgrade to F_S=2
and emit a warning if the user set something else:
```
x86_64-pc-linux-gnu-gcc -DEXEEXT=\"\" -I. -I../lib -DIN_M4_GNULIB_TESTS=1 -I.
-I. -I.. -I./.. -I../lib -I./../lib -O2 -pipe -march=native
-fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3
-Werror=implicit-function-declaration -Werror=implicit-int -c -o
glthread/thread.o glthread/thread.c
In file included from glthread/thread.c:20:
../lib/config.h:202: warning: "_FORTIFY_SOURCE" redefined
202 | # define _FORTIFY_SOURCE 2
|
<built-in>: note: this is the location of the previous definition
```
See: 390d259efe8e1c7e4b6babb4738fef7427416857
Signed-off-by: Sam James <sam@gentoo.org>
---
configure.ac | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index efa57d2e..574954bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -133,7 +133,9 @@ if test "$gl_gcc_warnings" = yes; then
[/* Enable compile-time and run-time bounds-checking, and some warnings,
without upsetting newer glibc. */
#if defined __OPTIMIZE__ && __OPTIMIZE__
- # define _FORTIFY_SOURCE 2
+ # ifndef _FORTIFY_SOURCE
+ # define _FORTIFY_SOURCE 2
+ # endif
#endif
])
fi
--
2.39.0
- [PATCH] build: Don't add _FORTIFY_SOURCE if already set by user/toolchain,
Sam James <=