aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-12-20 05:31:05 +0800
committerH.J. Lu <hjl.tools@gmail.com>2024-12-22 13:03:46 +0800
commit494eb254c37507e836b5c791a3dbd8552777ddf7 (patch)
treed475caa25ab979dca97c79600f1a3660c7f92240 /configure.ac
parent56cdc529fb553a307be459df3f1be90d1a231f0a (diff)
downloadglibc-494eb254c37507e836b5c791a3dbd8552777ddf7.tar.xz
glibc-494eb254c37507e836b5c791a3dbd8552777ddf7.zip
Add include/libc-misc.h
Add include/libc-misc.h to provide miscellaneous definitions for both glibc build and test: 1. Move inhibit_stack_protector to libc-misc.h and add Clang support. 2. Add test_inhibit_stack_protector for glibc testing. 3. Move inhibit_loop_to_libcall to libc-misc.h. 4. Add test_cc_inhibit_loop_to_libcall to handle TEST_CC != CC and replace inhibit_loop_to_libcall with test_cc_inhibit_loop_to_libcall in glibc tests. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Co-Authored-By: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac43
1 files changed, 27 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index aa0ec5d7ff..8f75b319a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -665,11 +665,14 @@ LIBC_TRY_TEST_CXX_COMMAND([for clang++],
)
LIBC_CONFIG_VAR([have-test-clangxx], [$libc_cv_test_clangxx])
-AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
-LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
- [libc_cv_ssp=yes],
- [libc_cv_ssp=no])
-])
+LIBC_TRY_CC_AND_TEST_CC_OPTION([for -fstack-protector],
+ [-Werror -fstack-protector],
+ libc_cv_ssp,
+ [libc_cv_ssp=yes],
+ [libc_cv_ssp=no],
+ libc_cv_test_ssp,
+ [libc_cv_test_ssp=yes],
+ [libc_cv_test_ssp=no])
AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
@@ -689,6 +692,10 @@ if test "$libc_cv_ssp" = yes; then
no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
fi
+if test "$libc_cv_test_ssp" = yes; then
+ AC_DEFINE(HAVE_TEST_CC_NO_STACK_PROTECTOR)
+fi
+
if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
stack_protector="-fstack-protector"
@@ -1506,22 +1513,26 @@ LIBC_TRY_TEST_CC_OPTION([for -ffloat-store],
LIBC_CONFIG_VAR([test-config-cflags-float-store],
[$libc_cv_test_cc_float_store])
-AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
-__attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
-cat > conftest.c <<EOF
+conftest_code="
void
-__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
+__attribute__ ((__optimize__ (\"-fno-tree-loop-distribute-patterns\")))
foo (void) {}
-EOF
-libc_cv_cc_loop_to_function=no
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
-then
- libc_cv_cc_loop_to_function=yes
-fi
-rm -f conftest*])
+"
+LIBC_TRY_CC_AND_TEST_CC_COMMAND([if __attribute__ ((__optimize__("-fno-tree-loop-distribute-patterns"))) works],
+ [$conftest_code],
+ [-c -Werror],
+ libc_cv_cc_loop_to_function,
+ [libc_cv_cc_loop_to_function=yes],
+ [libc_cv_cc_loop_to_function=no],
+ libc_cv_test_cc_loop_to_function,
+ [libc_cv_test_cc_loop_to_function=yes],
+ [libc_cv_test_cc_loop_to_function=no])
if test $libc_cv_cc_loop_to_function = yes; then
AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
fi
+if test $libc_cv_test_cc_loop_to_function = yes; then
+ AC_DEFINE(HAVE_TEST_CC_INHIBIT_LOOP_TO_LIBCALL)
+fi
AC_SUBST(libc_cv_cc_loop_to_function)
LIBC_TRY_CC_AND_TEST_CC_OPTION([for -Wimplicit-fallthrough],