[PATCH 58/59] configure: remove overly restrictive check for clang

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Sun Oct 26 18:53:23 GMT 2025



On 20/10/25 16:46, Collin Funk wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> 
>> The clang support is still experimental and not all testcase build
>> or run correctly.  Only clang 18 and onwards is supported and only
>> for x86_64-linux-gnu and aarch64-linux-gnu.
>> ---
>>  configure    | 13 +++++--------
>>  configure.ac |  4 ++--
>>  2 files changed, 7 insertions(+), 10 deletions(-)
> 
> s/testcase/testcases/
> 
>> diff --git a/configure b/configure
>> index c8ed16bd79d..083122a5ae0 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5800,7 +5800,7 @@ int
>>  main (void)
>>  {
>>  
>> -#if !defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)
>> +#if (!defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)) && (!defined __clang__ || __clang_major__ < 18)
>>  #error insufficient compiler
>>  #endif
>>    ;
>> @@ -7515,8 +7515,7 @@ $conftest_code
>>  EOF
>>  
>>  saved_CC="$CC"
>> -saved_CFLAGS="$CFLAGS"
>> -CC="$TEST_CC -Wno-unused-command-line-argument"
>> +CC="$TEST_CC"
>>  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for traditional tls support in testing" >&5
>>  printf %s "checking for traditional tls support in testing... " >&6; }
>>  if test ${libc_cv_test_mtls_traditional+y}
>> @@ -7739,7 +7738,7 @@ else case e in #(
>>  extern char *strstr (const char *, const char *) __asm ("my_strstr");
>>  char *foo (const char *a, const char *b)
>>  {
>> -  return __builtin_strstr (a, b);
>> +  return strstr (a, b);
>>  }
>>  EOF
>>  if { ac_try='${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null'
>> @@ -8110,8 +8109,7 @@ if test "$TEST_CC" = "$CC"; then
>>  else
>>  
>>  saved_CC="$CC"
>> -saved_CFLAGS="$CFLAGS"
>> -CC="$TEST_CC -Wno-unused-command-line-argument"
>> +CC="$TEST_CC"
>>  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -Wfree-labels in testing" >&5
>>  printf %s "checking for -Wfree-labels in testing... " >&6; }
>>  if test ${libc_cv_test_cc_wfree_labels+y}
>> @@ -8171,8 +8169,7 @@ if test "$TEST_CC" = "$CC"; then
>>  else
>>  
>>  saved_CC="$CC"
>> -saved_CFLAGS="$CFLAGS"
>> -CC="$TEST_CC -Wno-unused-command-line-argument"
>> +CC="$TEST_CC"
>>  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -Wmissing-parameter-name in testing" >&5
>>  printf %s "checking for -Wmissing-parameter-name in testing... " >&6; }
>>  if test ${libc_cv_test_cc_wmissing_parameter_name+y}
>> diff --git a/configure.ac b/configure.ac
>> index f5cbdd6bdb5..89659e905c7 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -585,7 +585,7 @@ AC_CHECK_PROG_VER(BISON, bison, --version,
>>  # Require GCC 12.1 to build.
>>  AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
>>  AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
>> -#if !defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)
>> +#if (!defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)) && (!defined __clang__ || __clang_major__ < 18)
>>  #error insufficient compiler
>>  #endif]])],
>>  	       [libc_cv_compiler_ok=yes],
>> @@ -1507,7 +1507,7 @@ cat > conftest.c <<\EOF
>>  extern char *strstr (const char *, const char *) __asm ("my_strstr");
>>  char *foo (const char *a, const char *b)
>>  {
>> -  return __builtin_strstr (a, b);
>> +  return strstr (a, b);
>>  }
>>  EOF
>>  dnl
> 
> This patch looks reasonable, so:
> 
> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
> 
> However, I wonder if it is worth mentioning in INSTALL that Clang
> support is experimental and requires version 18.
> 
> Or perhaps there is somewhere else that belongs? Anywhere more visible
> configure.ac is probably fine with me.

I think we can add a NEWS entry stating that clang build support is experimental
and that gcc runtime is still required (I am still working on compiler-rt support,
which is required to bootstrap without gcc).  I will add a NEW entry for v2.



More information about the Libc-alpha mailing list