This post serves as a tracker of code submitted in the domain of this GSoC project.
This summer, I worked out a bunch of patches that enhance clang/llvm with support for musl-libc, and had those patches contributed upstream. With these patches, clang is now able to correctly link binaries with musl.
clang musl-libc support:
There’s still a pending compatibility issue that prevents llvm itself from being built on musl as is. musl and llvm’s developers have different views on this issue , and I haven’t yet found a solution that pleases both side. Currently we’re using a downstream patch in Gentoo to make llvm and musl compatible .
To have clang not link binaries with libgcc, I contributed another patch to clang that allows compiler-rt to be used as the default runtime library:
With those upstream enhancements, I wrote several ebuilds for Gentoo to construct a GCC-free C++ runtime environment, including:
- create new packages for LLVM’s libunwind and libc++abi
- enhance libc++ to support libc++abi and libunwind
- make llvm compatible with musl-libc
- enhance clang to support libc++ as the default stdlib and compiler-rt as the default rtlib
- create a profile for using clang as the default compiler in Gentoo
Code submitted to Gentoo:
Once the pending pull requests are merged, I’ll deliver a proper Gentoo stage3 with clang as the default compiler and all packages (except for kernel) built with clang.