Table of Contents
This is a proposal to start llvm-libc, an implementation of the C standard library targeting C17 and above, as part of the LLVM project. llvm-libc will also provide platform specific extensions as relevant. For example, on Linux it also provides pthreads, librt and other POSIX extension libraries.
llvm-libc will be developed to have a certain minimum set of features:
Implementing a libc is no small task and is not be taken lightly. A natural question to ask is, “why a new implementation of the C standard library?” There is no single answer to this question, but some of the major reasons are as follows:
We envision that llvm-libc will support a variety of platforms in the coming years. Interested parties are encouraged to participate in the design and implementation, and add support for their favorite platforms.
As llvm-libc is new, it will not offer ABI stability in the initial stages. However, as we’ve heard from other LLVM contributors that they are interested in having ABI stability, llvm-libc code will be written in a manner which is amenable to ABI stability. We are looking for contributors interested in driving the design in this space to help us define what exactly does ABI stability mean for llvm-libc.
When meaningful and practically possible on a platform, llvm-libc will be developed in a fashion that it will be possible to layer it over the system libc. This does not mean that one can mix llvm-libc with the system-libc. Also, it does not mean that layering is the only way to use llvm-libc. What it means is that, llvm-libc can optionally be packaged in a way that it can delegate parts of the functionality to the system-libc. The delegation happens internal to llvm-libc and is invisible to the users. From the user’s point of view, they only call into llvm-libc.
There are a few problems one needs to be mindful of when implementing such a delegation scheme in llvm-libc. Examples of such problems are:
1. One cannot mix data structures from llvm-libc with those from the system-libc. A translation from one set of data structures to the other should happen internal to llvm-libc. 2. The delegation mechanism has to be implemented over a related set of functions. For example, one cannot delegate just the fopen function to the system-libc. One will have to delegate all FILE related functions to the system-libc.
llvm-libc development is still in the planning phase.
Once the development starts, there will be llvm-libc focused builders added to the LLVM BuildBot.