[glibc] stdio-common: Use clang with bugfix for bug28
Sam James
sjames@sourceware.org
Tue Dec 24 11:34:10 GMT 2024
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5a96da210c15e18c3c5298dc23a9e2e57691b6c6
commit 5a96da210c15e18c3c5298dc23a9e2e57691b6c6
Author: Dmitry Chestnykh <dm.chestnykh@gmail.com>
Date: Tue Dec 24 11:52:35 2024 +0300
stdio-common: Use clang with bugfix for bug28
The issue that was the cause of hang was fixed in upstream.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diff:
---
configure | 42 ++++++++++++++++++++++++++++++++++++++++++
configure.ac | 15 +++++++++++++++
stdio-common/Makefile | 8 ++++----
3 files changed, 61 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 052113bcea..4f77900818 100755
--- a/configure
+++ b/configure
@@ -6069,6 +6069,48 @@ rm -f conftest*
config_vars="$config_vars
have-test-clangxx = $libc_cv_test_clangxx"
+if test "$libc_cv_test_clang" = "yes"; then
+ conftest_code="
+ #if __clang_major__ > 19
+ #error clang version > 19
+ #endif
+ "
+
+cat > conftest.c <<EOF
+$conftest_code
+EOF
+
+saved_CC="$CC"
+CC="$TEST_CC"
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clang in testing" >&5
+printf %s "checking for clang in testing... " >&6; }
+if test ${libc_cv_test_clang_19_or_less+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c -o conftest 1>&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ libc_cv_test_clang_19_or_less=yes
+ else
+ libc_cv_test_clang_19_or_less=no
+ fi ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_clang_19_or_less" >&5
+printf "%s\n" "$libc_cv_test_clang_19_or_less" >&6; }
+
+CC="$saved_CC"
+
+rm -f conftest*
+fi
+config_vars="$config_vars
+have-test-clang-19-or-less = $libc_cv_test_clang_19_or_less"
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -fstack-protector" >&5
printf %s "checking for -fstack-protector... " >&6; }
diff --git a/configure.ac b/configure.ac
index fc5ddb8561..5f60b523bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -665,6 +665,21 @@ LIBC_TRY_TEST_CXX_COMMAND([for clang++],
)
LIBC_CONFIG_VAR([have-test-clangxx], [$libc_cv_test_clangxx])
+if test "$libc_cv_test_clang" = "yes"; then
+ conftest_code="
+ #if __clang_major__ > 19
+ #error clang version > 19
+ #endif
+ "
+ LIBC_TRY_TEST_CC_COMMAND([for clang],
+ [$conftest_code],
+ [-c],
+ libc_cv_test_clang_19_or_less,
+ [libc_cv_test_clang_19_or_less=yes], [libc_cv_test_clang_19_or_less=no],
+ )
+fi
+LIBC_CONFIG_VAR([have-test-clang-19-or-less], [$libc_cv_test_clang_19_or_less])
+
LIBC_TRY_CC_AND_TEST_CC_OPTION([for -fstack-protector],
[-Werror -fstack-protector],
libc_cv_ssp,
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 3f84de3e36..289ea9dc20 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -317,10 +317,10 @@ tests := \
# tests
# Clang 19 takes a very long time, it ran more than 27 minutes on Intel
-# Core i7-1195G7 before the process was killed, to compile bug28.c:
-# https://github.com/llvm/llvm-project/issues/120462
-# Exclude it when Clang is used for testing.
-ifneq ($(have-test-clang),yes)
+# Core i7-1195G7 before the process was killed, to compile bug28.c
+# The issue was fixed in upstream but check if clang has the version that has the fix
+# https://github.com/llvm/llvm-project/commit/99dddef340e566e9d303010f1219f7d7d6d37a11 .
+ifneq ($(have-test-clang-19-or-less),yes)
tests += \
bug28 \
# tests
More information about the Glibc-cvs
mailing list