From a8455a0b7f9288aca4eaa103f94fe8f55d750f1b Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 9 Dec 2025 11:58:32 -0300 Subject: [PATCH] configure: use TEST_CC to check for --no-error-execstack The ld.lld does not support the --no-error-execstack option, and it is required only to suppress the linker warning while building tests. A new configure macro, LIBC_TEST_LINKER_FEATURE, is added to check for linker features using TEST_CC instead of CC. Checked on x86_64-linux-gnu and aarch64-linux-gnu with gcc and TEST_CC set to clang-18 and clan-21. Reviewed-by: Sam James --- aclocal.m4 | 32 ++++++++++++++++++++++++++++++++ configure | 9 ++++++--- configure.ac | 6 +++--- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 5c25a71d8f..b32076d8d0 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -268,6 +268,38 @@ else fi AC_MSG_RESULT($libc_linker_feature)]) +dnl Check linker option support. +dnl LIBC_TEST_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false]) +AC_DEFUN([LIBC_TEST_LINKER_FEATURE], +[AC_MSG_CHECKING([for linker that supports $1]) +libc_linker_feature=no +cat > conftest.c <&AS_MESSAGE_LOG_FD]) +then + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \ + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ + | grep "warning: $1 ignored" > /dev/null 2>&1; then + true + else + libc_linker_feature=yes + fi +fi +rm -f conftest* +if test $libc_linker_feature = yes; then + $3 +else + $4 +fi +CC="$saved_CC" +AC_MSG_RESULT($libc_linker_feature)]) + dnl Add a makefile variable, with value set from a shell string dnl (expanded by the shell inside double quotes), to config.make. dnl LIBC_CONFIG_VAR(make-variable, shell-value) diff --git a/configure b/configure index 9e79accc43..f93530f7ba 100755 --- a/configure +++ b/configure @@ -659,7 +659,7 @@ libc_cv_has_glob_dat libc_cv_fpie libc_cv_test_static_pie libc_cv_z_execstack -libc_cv_no_error_execstack +libc_cv_test_no_error_execstack ASFLAGS_config libc_cv_cc_with_libunwind libc_cv_insert @@ -7142,6 +7142,8 @@ libc_linker_feature=no cat > conftest.c <