[enable_stack_protector=no])
case "$enable_stack_protector" in
all|yes|no|strong) ;;
-*) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
+*) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: "$enable_stack_protector"]);;
esac
dnl On some platforms we cannot use dynamic loading. We must provide
fi
fi
-dnl For the development we sometimes want gcc to issue even more warnings.
-dnl This is not the default since many of the extra warnings are not
-dnl appropriate.
-AC_ARG_ENABLE([all-warnings],
- AS_HELP_STRING([--enable-all-warnings],
- [enable all useful warnings gcc can issue]),
- [all_warnings=$enableval],
- [])
-AC_SUBST(all_warnings)
-
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--disable-werror],
[do not build with -Werror]),
[multi_arch=$enableval],
[multi_arch=default])
-AC_ARG_ENABLE([experimental-malloc],
- AS_HELP_STRING([--disable-experimental-malloc],
- [disable experimental malloc features]),
- [experimental_malloc=$enableval],
- [experimental_malloc=yes])
-AC_SUBST(experimental_malloc)
-
AC_ARG_ENABLE([memory-tagging],
AS_HELP_STRING([--enable-memory-tagging],
[enable memory tagging if supported by the architecture @<:@default=no@:>@]),
AC_SUBST(memory_tagging)
AC_ARG_ENABLE([crypt],
- AS_HELP_STRING([--disable-crypt],
- [do not build nor install the passphrase hashing library, libcrypt]),
+ AS_HELP_STRING([--enable-crypt],
+ [build and install the legacy passphrase hashing library, libcrypt]),
[build_crypt=$enableval],
- [build_crypt=yes])
+ [build_crypt=no])
AC_SUBST(build_crypt)
AC_ARG_ENABLE([nss-crypt],
AC_DEFINE(HAVE_PT_CHOWN)
fi
-AC_ARG_ENABLE([tunables],
- [AS_HELP_STRING([--enable-tunables],
- [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
- [have_tunables=$enableval],
- [have_tunables=yes])
-AC_SUBST(have_tunables)
-if test "$have_tunables" = yes; then
- AC_DEFINE(HAVE_TUNABLES)
-fi
-
# The abi-tags file uses a fairly simplistic model for name recognition that
# can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
# $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
[enable_cet=$libc_cv_compiler_default_cet])
AC_ARG_ENABLE([scv],
- AC_HELP_STRING([--disable-scv],
+ AS_HELP_STRING([--disable-scv],
[syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
[use_scv=$enableval],
[use_scv=yes])
AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
+dnl Build glibc with _FORTIFY_SOURCE
+AC_ARG_ENABLE(fortify-source,
+ AS_HELP_STRING([--enable-fortify-source@<:@=1|2|3@:>@],
+ [Use -D_FORTIFY_SOURCE=[1|2|3] to control code hardening, defaults to highest possible value supported by the build compiler.]),
+ [enable_fortify_source=$enableval],
+ [enable_fortify_source=no])
+case "$enable_fortify_source" in
+1|2|3|no|yes) ;;
+*) AC_MSG_ERROR([Not a valid argument for --enable-fortify-source: "$enable_fortify_source"]);;
+esac
+
# We keep the original values in `$config_*' and never modify them, so we
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
dnl clang emits an warning for a double alias redirection, to warn the
-dnl original symbol is sed even when weak definition overriddes it.
+dnl original symbol is sed even when weak definition overrides it.
dnl It is a usual pattern for weak_alias, where multiple alias point to
dnl same symbol.
AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
fi
AC_SUBST(have_selinux)
-CPPUNDEFS=
-dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
-dnl Since we are building the implementations of the fortified functions here,
-dnl having the macro defined interacts very badly.
-dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
-dnl and above (see "man FEATURE_TEST_MACROS").
-dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
-AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
-#ifdef _FORTIFY_SOURCE
-# error bogon
-#endif]])],
- [libc_cv_predef_fortify_source=no],
- [libc_cv_predef_fortify_source=yes])])
-if test $libc_cv_predef_fortify_source = yes; then
- CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
-fi
-AC_SUBST(CPPUNDEFS)
+dnl Check if we support the requested _FORTIFY_SOURCE level
+dnl If not, then don't use it.
+dnl Note that _FORTIFY_SOURCE may have been set through FLAGS too.
+dnl _FORTIFY_SOURCE value will be selectively disabled for function that can't
+dnl support it
+no_fortify_source="-Wp,-U_FORTIFY_SOURCE"
+fortify_source="${no_fortify_source}"
+
+AC_CACHE_CHECK([for maximum supported _FORTIFY_SOURCE level],
+ [libc_cv_supported_fortify_source], [
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_dynamic_object_size("", 0)])],
+ [libc_cv_supported_fortify_source=3],
+ [libc_cv_supported_fortify_source=2])
+])
+
+AS_CASE([$enable_fortify_source],
+ [yes], [libc_cv_fortify_source=yes enable_fortify_source=$libc_cv_supported_fortify_source],
+ [1|2], [libc_cv_fortify_source=yes],
+ [3], [AS_IF([test $libc_cv_supported_fortify_source = 3],
+ [libc_cv_fortify_source=yes],
+ [AC_MSG_ERROR([Compiler doesn't provide necessary support for _FORTIFY_SOURCE=3])])],
+ [libc_cv_fortify_source=no])
+
+AS_IF([test "$libc_cv_fortify_source" = yes],
+ [fortify_source="${fortify_source},-D_FORTIFY_SOURCE=${enable_fortify_source}"]
+ )
+
+AC_SUBST(enable_fortify_source)
+AC_SUBST(libc_cv_fortify_source)
+AC_SUBST(no_fortify_source)
+AC_SUBST(fortify_source)
+LIBC_CONFIG_VAR([supported-fortify], [$libc_cv_supported_fortify_source])
dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
dnl to one symbol (PR 23840).