mirror of
https://mirrors.tuna.tsinghua.edu.cn/git/glibc.git
synced 2026-01-12 00:20:19 +08:00
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>
This commit is contained in:
43
configure.ac
43
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],
|
||||
|
||||
Reference in New Issue
Block a user