[PATCH v2 0/6] Enable glibc build with LLVM compiler-rt and libunwind
Adhemerval Zanella
adhemerval.zanella@linaro.org
Wed Feb 25 18:31:11 GMT 2026
This patch series implements the necessary infrastructure changes to
build glibc using a full LLVM-based toolchain, specifically replacing
libgcc with compiler-rt builtins and libunwind.
Historically, glibc has tightly coupled its build system and runtime
assumptions to GCC's specific runtime libraries (libgcc.a, libgcc_eh.a,
libgcc_s.so). This series decouples those dependencies by:
1. Providing missing soft-float exception handlers
(__sfp_handle_exceptions) that are absent in compiler-rt.
2. Parametrizing the build system to detect the compiler's runtime
library rather than hardcoding -lgcc.
3. Adapting the unwind-link facility to dynamically load and interact
with libunwind.so instead of libgcc_s.so.
Please note that this support is currently EXPERIMENTAL. While the
build completes and the resulting libc is functional for general use,
there are known gaps in the LLVM runtime implementation regarding
floating-point exception signaling and C++ library integration.
1. libc++ support is not tested: it does not yet enable building
against LLVM's C++ standard library (libc++). The build
environment still relies on libstdc++ for any C++ dependencies
(e.g., testsuite components). Work on enabling libc++ support is
ongoing.
2. The libclang_rt builtins library does not currently generate proper
floating-point exceptions for _Float128 (x86_64 and aarch64).
This leads to lot failures in math tests.
3. iThere are additional regressions in the testsuite.
Below is a summary of the test results on x86_64 and aarch64 using
clang-22 built with -DCLANG_DEFAULT_RTLIB=compiler-rt and
-DCLANG_DEFAULT_UNWINDLIB=libunwind (only the failures).
Changes from v1:
- Fixed an issue with the libc_cv_cc_with_libunwind configure check
triggered by CI.
- Disable exception check for soft-fp routine with compiler-rt.
aarch64:
FAIL: check-local-headers
FAIL: conform/ISO11/tgmath.h/conform
FAIL: conform/ISO99/tgmath.h/conform
FAIL: conform/POSIX2008/tgmath.h/conform
FAIL: conform/XOPEN2K/tgmath.h/conform
FAIL: conform/XOPEN2K8/tgmath.h/conform
FAIL: elf/check-localplt
FAIL: elf/tst-tls23
FAIL: elf/tst-tlsdesc-pac
FAIL: math/basic-test
FAIL: math/test-double-ldouble-add
FAIL: math/test-double-ldouble-div
FAIL: math/test-double-ldouble-fma
FAIL: math/test-double-ldouble-mul
FAIL: math/test-double-ldouble-sqrt
FAIL: math/test-double-ldouble-sub
FAIL: math/test-double-nexttoward
FAIL: math/test-float-ldouble-add
FAIL: math/test-float-ldouble-div
FAIL: math/test-float-ldouble-fma
FAIL: math/test-float-ldouble-mul
FAIL: math/test-float-ldouble-sqrt
FAIL: math/test-float-ldouble-sub
FAIL: math/test-float-nexttoward
FAIL: math/test-float128-ccos
FAIL: math/test-float128-ccosh
FAIL: math/test-float128-cexp
FAIL: math/test-float128-compoundn
FAIL: math/test-float128-cosh
FAIL: math/test-float128-csin
FAIL: math/test-float128-csinh
FAIL: math/test-float128-exp
FAIL: math/test-float128-exp10
FAIL: math/test-float128-exp10m1
FAIL: math/test-float128-exp2
FAIL: math/test-float128-exp2m1
FAIL: math/test-float128-expm1
FAIL: math/test-float128-fdim
FAIL: math/test-float128-fma
FAIL: math/test-float128-hypot
FAIL: math/test-float128-j0
FAIL: math/test-float128-lgamma
FAIL: math/test-float128-pow
FAIL: math/test-float128-pown
FAIL: math/test-float128-powr
FAIL: math/test-float128-rootn
FAIL: math/test-float128-scalbln
FAIL: math/test-float128-scalbn
FAIL: math/test-float128-sinh
FAIL: math/test-float128-tgamma
FAIL: math/test-float128-y1
FAIL: math/test-float128-yn
FAIL: math/test-float32-float128-add
FAIL: math/test-float32-float128-div
FAIL: math/test-float32-float128-fma
FAIL: math/test-float32-float128-mul
FAIL: math/test-float32-float128-sqrt
FAIL: math/test-float32-float128-sub
FAIL: math/test-float32-float64x-add
FAIL: math/test-float32-float64x-div
FAIL: math/test-float32-float64x-fma
FAIL: math/test-float32-float64x-mul
FAIL: math/test-float32-float64x-sqrt
FAIL: math/test-float32-float64x-sub
FAIL: math/test-float32x-float128-add
FAIL: math/test-float32x-float128-div
FAIL: math/test-float32x-float128-fma
FAIL: math/test-float32x-float128-mul
FAIL: math/test-float32x-float128-sqrt
FAIL: math/test-float32x-float128-sub
FAIL: math/test-float32x-float64x-add
FAIL: math/test-float32x-float64x-div
FAIL: math/test-float32x-float64x-fma
FAIL: math/test-float32x-float64x-mul
FAIL: math/test-float32x-float64x-sqrt
FAIL: math/test-float32x-float64x-sub
FAIL: math/test-float64-float128-add
FAIL: math/test-float64-float128-div
FAIL: math/test-float64-float128-fma
FAIL: math/test-float64-float128-mul
FAIL: math/test-float64-float128-sqrt
FAIL: math/test-float64-float128-sub
FAIL: math/test-float64-float64x-add
FAIL: math/test-float64-float64x-div
FAIL: math/test-float64-float64x-fma
FAIL: math/test-float64-float64x-mul
FAIL: math/test-float64-float64x-sqrt
FAIL: math/test-float64-float64x-sub
FAIL: math/test-float64x-ccos
FAIL: math/test-float64x-ccosh
FAIL: math/test-float64x-cexp
FAIL: math/test-float64x-compoundn
FAIL: math/test-float64x-cosh
FAIL: math/test-float64x-csin
FAIL: math/test-float64x-csinh
FAIL: math/test-float64x-exp
FAIL: math/test-float64x-exp10
FAIL: math/test-float64x-exp10m1
FAIL: math/test-float64x-exp2
FAIL: math/test-float64x-exp2m1
FAIL: math/test-float64x-expm1
FAIL: math/test-float64x-fdim
FAIL: math/test-float64x-float128-add
FAIL: math/test-float64x-float128-div
FAIL: math/test-float64x-float128-fma
FAIL: math/test-float64x-float128-mul
FAIL: math/test-float64x-float128-sub
FAIL: math/test-float64x-fma
FAIL: math/test-float64x-hypot
FAIL: math/test-float64x-j0
FAIL: math/test-float64x-lgamma
FAIL: math/test-float64x-pow
FAIL: math/test-float64x-pown
FAIL: math/test-float64x-powr
FAIL: math/test-float64x-rootn
FAIL: math/test-float64x-scalbln
FAIL: math/test-float64x-scalbn
FAIL: math/test-float64x-sinh
FAIL: math/test-float64x-tgamma
FAIL: math/test-float64x-y1
FAIL: math/test-float64x-yn
FAIL: math/test-ldouble-ccos
FAIL: math/test-ldouble-ccosh
FAIL: math/test-ldouble-cexp
FAIL: math/test-ldouble-compoundn
FAIL: math/test-ldouble-cosh
FAIL: math/test-ldouble-csin
FAIL: math/test-ldouble-csinh
FAIL: math/test-ldouble-exp
FAIL: math/test-ldouble-exp10
FAIL: math/test-ldouble-exp10m1
FAIL: math/test-ldouble-exp2
FAIL: math/test-ldouble-exp2m1
FAIL: math/test-ldouble-expm1
FAIL: math/test-ldouble-fdim
FAIL: math/test-ldouble-fma
FAIL: math/test-ldouble-hypot
FAIL: math/test-ldouble-j0
FAIL: math/test-ldouble-lgamma
FAIL: math/test-ldouble-pow
FAIL: math/test-ldouble-pown
FAIL: math/test-ldouble-powr
FAIL: math/test-ldouble-rootn
FAIL: math/test-ldouble-scalb
FAIL: math/test-ldouble-scalbln
FAIL: math/test-ldouble-scalbn
FAIL: math/test-ldouble-sinh
FAIL: math/test-ldouble-tgamma
FAIL: math/test-ldouble-y1
FAIL: math/test-ldouble-yn
FAIL: math/test-misc
FAIL: math/test-tgmath
FAIL: math/test-tgmath2
FAIL: nptl/tst-once5
FAIL: nptl/tst-pthread-gdb-attach
FAIL: nptl/tst-pthread-gdb-attach-static
FAIL: nptl/tst-sem_getvalue-affinity
FAIL: posix/tst-libc-message
FAIL: stdlib/testmb2
FAIL: stdlib/tst-qsort7-mem
FAIL: stdlib/tst-qsortx7-mem
FAIL: stdlib/tst-strtod-round
FAIL: stdlib/tst-strtod-underflow
FAIL: wcsmbs/tst-wcstod-round
x86_64:
FAIL: check-local-headers
FAIL: conform/ISO11/tgmath.h/conform
FAIL: conform/ISO99/tgmath.h/conform
FAIL: conform/POSIX2008/tgmath.h/conform
FAIL: conform/XOPEN2K/tgmath.h/conform
FAIL: conform/XOPEN2K8/tgmath.h/conform
FAIL: elf/check-localplt
FAIL: intl/tst-gettext
FAIL: math/test-float128-ccos
FAIL: math/test-float128-ccosh
FAIL: math/test-float128-cexp
FAIL: math/test-float128-clog
FAIL: math/test-float128-clog10
FAIL: math/test-float128-compoundn
FAIL: math/test-float128-cosh
FAIL: math/test-float128-csin
FAIL: math/test-float128-csinh
FAIL: math/test-float128-exp
FAIL: math/test-float128-exp10
FAIL: math/test-float128-exp10m1
FAIL: math/test-float128-exp2
FAIL: math/test-float128-exp2m1
FAIL: math/test-float128-expm1
FAIL: math/test-float128-fdim
FAIL: math/test-float128-fma
FAIL: math/test-float128-hypot
FAIL: math/test-float128-j0
FAIL: math/test-float128-jn
FAIL: math/test-float128-lgamma
FAIL: math/test-float128-pow
FAIL: math/test-float128-pown
FAIL: math/test-float128-powr
FAIL: math/test-float128-rootn
FAIL: math/test-float128-scalbln
FAIL: math/test-float128-scalbn
FAIL: math/test-float128-sinh
FAIL: math/test-float128-tgamma
FAIL: math/test-float128-y1
FAIL: math/test-float128-yn
FAIL: math/test-float32-float128-add
FAIL: math/test-float32-float128-div
FAIL: math/test-float32-float128-fma
FAIL: math/test-float32-float128-mul
FAIL: math/test-float32-float128-sqrt
FAIL: math/test-float32-float128-sub
FAIL: math/test-float32x-float128-add
FAIL: math/test-float32x-float128-div
FAIL: math/test-float32x-float128-fma
FAIL: math/test-float32x-float128-mul
FAIL: math/test-float32x-float128-sqrt
FAIL: math/test-float32x-float128-sub
FAIL: math/test-float64-float128-add
FAIL: math/test-float64-float128-div
FAIL: math/test-float64-float128-fma
FAIL: math/test-float64-float128-mul
FAIL: math/test-float64-float128-sqrt
FAIL: math/test-float64-float128-sub
FAIL: math/test-float64x-float128-add
FAIL: math/test-float64x-float128-div
FAIL: math/test-float64x-float128-fma
FAIL: math/test-float64x-float128-mul
FAIL: math/test-float64x-float128-sqrt
FAIL: math/test-float64x-float128-sub
FAIL: math/test-float64x-fpclassify
FAIL: math/test-float64x-isinf
FAIL: math/test-float64x-setpayload
FAIL: math/test-ldouble-fpclassify
FAIL: math/test-ldouble-isinf
FAIL: math/test-ldouble-scalb
FAIL: math/test-ldouble-setpayload
FAIL: math/test-tgmath
FAIL: math/test-tgmath2
FAIL: nptl/tst-once5
FAIL: nptl/tst-pthread-gdb-attach
FAIL: nptl/tst-pthread-gdb-attach-static
FAIL: nscd/tst-nscd-basic
FAIL: posix/tst-libc-message
FAIL: stdlib/testmb2
FAIL: stdlib/tst-qsort7-mem
FAIL: stdlib/tst-qsortx7-mem
FAIL: stdlib/tst-strtod-round
FAIL: stdlib/tst-strtod-underflow
FAIL: wcsmbs/tst-wcstod-round
Adhemerval Zanella (6):
x86_64: Conditionally define __sfp_handle_exceptions for compiler-rt
configure: Parametrize runtime libraries to support compiler-rt
configure: Repurpose have-cc-with-libunwind for clang support
nptl: Only issues __libc_unwind_link_get for SHARED
Support loading libunwind instead of libgcc_s
math: Disable exception check for soft-fp routine with compiler-rt
Makeconfig | 18 ++--
Makerules | 3 +-
config.h.in | 6 ++
config.make.in | 1 -
configure | 131 +++++++++++++++++++++++-
configure.ac | 45 +++++++-
dlfcn/Makefile | 2 +-
elf/Makefile | 6 +-
misc/unwind-link.c | 34 +++++-
nptl/pthread_cancel.c | 2 +-
nptl/pthread_exit.c | 4 +-
shlib-versions | 2 +
support/Makefile | 6 +-
sysdeps/aarch64/math-tests-exceptions.h | 34 ++++++
sysdeps/generic/unwind-link.h | 13 +++
sysdeps/generic/unwind-resume.c | 32 ++++++
sysdeps/x86/fpu/Makefile | 5 +-
sysdeps/x86/fpu/sfp-exceptions.c | 74 +++++++++++++
sysdeps/x86_64/math-tests-exceptions.h | 33 ++++++
19 files changed, 422 insertions(+), 29 deletions(-)
create mode 100644 sysdeps/aarch64/math-tests-exceptions.h
create mode 100644 sysdeps/x86/fpu/sfp-exceptions.c
create mode 100644 sysdeps/x86_64/math-tests-exceptions.h
--
2.43.0
More information about the Libc-alpha
mailing list