[PATCH v6 3/3] configure: Enable experimental support for clang
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Mon Dec 8 13:22:00 GMT 2025
On 06/12/25 10:28, Sam James wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>
>> The clang support is still experimental and not all testcases run
>> correctly. Only clang 18 and onwards is supported and only
>> for x86_64-linux-gnu and aarch64-linux-gnu.
>>
>> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
>
> Reviewed-by: Sam James <sam@gentoo.org>
>
>> ---
>> NEWS | 5 +++++
>> configure | 2 +-
>> configure.ac | 2 +-
>> 3 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/NEWS b/NEWS
>> index 81c7e04293..d1f8c9a0f8 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -46,6 +46,11 @@ Major new features:
>> lgammaf/lgammaf_r, log10f, sinhf, sqrtf, tgammaf, y0/j0, y1/j1, and yn/jn
>> were moved to compat symbols, allowing improvements in performance.
>>
>> +* Experimental support for building with clang has been added. It requires
>> + at least clang version 18, aarch64-linux-gnu or x86_64-linux-gnu
>> + targets, and libgcc compatible runtime (including libgcc_s.so for
>> + pthread cancellation and backtrace runtime support).
>> +
>> Deprecated and removed features, and other changes affecting compatibility:
>>
>> * Support for dumped heaps has been removed - malloc_set_state() now always
>> diff --git a/configure b/configure
>> index 878c7cc7e8..933c8c6b00 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5799,7 +5799,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
>> ;
>> diff --git a/configure.ac b/configure.ac
>> index 589d07f073..9ba8472fa5 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)
>
> We may want to crank this up before release given I wouldn't be
> surprised if we run into issues fixed in latest Clang but won't worry
> about it for now.
Do you mean setting a higher clang version as the minimum requirement? As
least on my testing, clang-19 does improve some regression but most are
ifunc corner cases.
I set clang 18 as the minimum version because it is the default version
used ubuntu 24, but I recall that I have started with clang 16 and
at least for x86_64/aarch64 it required some other patches but it should
be feasible support is as well.
>
>> #error insufficient compiler
>> #endif]])],
>> [libc_cv_compiler_ok=yes],
More information about the Libc-alpha
mailing list