newlib: ignore _FORTIFY_SOURCE when building newlib

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, ignore it when building the code.
This also matches what glibc is doing.
This commit is contained in:
Mike Frysinger 2021-11-08 21:42:12 -05:00
parent 372093689c
commit df5de02e0e
1 changed files with 2 additions and 1 deletions

View File

@ -320,7 +320,8 @@ extern "C" {
#endif
#if _FORTIFY_SOURCE > 0 && !defined(__cplusplus) && !defined(__lint__) && \
(__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1)
(__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1) && \
!defined(_COMPILING_NEWLIB)
# if _FORTIFY_SOURCE > 1
# define __SSP_FORTIFY_LEVEL 2
# else