diff --git a/llvm/docs/Proposals/LLVMLibC.rst b/llvm/docs/Proposals/LLVMLibC.rst new file mode 100644 --- /dev/null +++ b/llvm/docs/Proposals/LLVMLibC.rst @@ -0,0 +1,93 @@ +============================== +"llvm-libc" C Standard Library +============================== + +.. contents:: Table of Contents + :depth: 4 + :local: + +Introduction +============ + +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. + +Features +======== + +llvm-libc will be developed to have a certain minimum set of features: + +- C17 and upwards conformant. Since the C17 standard is only a bugfix + upgrade of the C11 standard, llvm-libc is effectively C11 and + upwards conformant. +- A modular libc with individual pieces implemented in the "as a + library" philosophy of the LLVM project. +- Ability to layer this libc over the system libc. +- Provide C symbols as specified by the standards, but take advantage + and use C++ language facilities for the core implementation. +- Provides POSIX extensions on POSIX compliant platforms. +- Provides system-specific extensions as appropriate. For example, + provides the Linux API on Linux. +- Vendor extensions if and only if necessary. +- Designed and developed from the start to work with LLVM tooling and + testing like fuzz testing and sanitizer-supported testing. +- ABI independent implementation as far as possible. +- Use source based implementations as far possible rather than + assembly. Will try to *fix* the compiler rather than use assembly + language workarounds. +- Extensive unit testing and standards conformance testing. If relevant + and possible, differential testing: We want to be able + to test llvm-libc against another battle-tested libc. This is + essentially to understand how we differ from other libcs. Also if + relevant and possible, test against the testsuite of an another + battle-tested libc implementation. + +Why a new C Standard Library? +============================= + +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: + +- Most libc implementations are monolithic. It is a non-trivial + porting task to pick and choose only the pieces relevant to one's + platform. The llvm-libc will be developed with sufficient modularity to + make picking and choosing a straightforward task. +- Most libc implementations break when built with sanitizer specific + compiler options. The llvm-libc will be developed from the start to + work with those specialized compiler options. +- The llvm-libc will be developed to support and employ fuzz testing + from the start. +- Most libc implementations use a good amount of assembly language, + and assume specific ABIs (may be platform dependent). With the llvm-libc + implementation, we want to use normal source code as much as possible so + that compiler-based changes to the ABI are easy. Moreover, as part of the + LLVM project, we want to use this opportunity to fix performance related + compiler bugs rather than using assembly workarounds. +- A large hole in the llvm toolchain will be plugged with llvm-libc. + With the broad platform expertise in the LLVM community, and the + strong license and project structure, we think that llvm-libc will + be more tunable and robust, without sacrificing the simplicity and + accessibility typical of the LLVM project. + +Platform Support +================ + +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. + +Current Status +============== + +llvm-libc development is still in the planning phase. + +Build Bots +========== + +Once the development starts, there will be llvm-libc focused builders added to +the LLVM BuildBot.