[PATCH] newlib: undefine _FORTIFY_SOURCE

Mike Frysinger vapier@gentoo.org
Tue Nov 9 02:56:56 GMT 2021


Some distros enable _FORTIFY_SOURCE by default which upsets building
newlib which itself implements the logic for this define.  For example,
building gets.c fails because the includes set up a gets() macro which
expands in the definition.

Since newlib isn't prepared to build itself with _FORTIFY_SOURCE, and
it's not clear if it's even useful, disable it when building the code.
This also matches what glibc is doing.
---
 newlib/configure.host | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/configure.host b/newlib/configure.host
index e737f73f5f75..cb0c5d01f874 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -54,7 +54,7 @@
 #   have_init_fini	have init/fini ("yes" or "no", set to "yes" by default)
 #   noinclude		list of include files to not install
 
-newlib_cflags="-D_COMPILING_NEWLIB"
+newlib_cflags="-D_COMPILING_NEWLIB -U_FORTIFY_SOURCE"
 libm_machine_dir=
 machine_dir=
 shared_machine_dir=
-- 
2.33.0



More information about the Newlib mailing list