1======================================================== 2llvm-libc: An ISO C-conformant Standard Library for LLVM 3======================================================== 4 5**llvm-libc library is not complete. If you need a fully functioning libc right 6now, you should continue to use your standard system libc.** 7 8.. contents:: Table of Contents 9 :depth: 4 10 :local: 11 12Goals 13===== 14 15- C17 and upwards conformant. 16- A modular libc with individual pieces implemented in the "as a 17 library" philosophy of the LLVM project. 18- Ability to layer this libc over the system libc if possible and desired 19 for a platform. 20- Provide POSIX extensions on POSIX compliant platforms. 21- Provide system-specific extensions as appropriate. For example, 22 provide the Linux API on Linux. 23- Designed and developed from the start to work with LLVM tooling, fuzz testing 24 and sanitizer-supported testing. 25- Use source based implementations as far possible rather than 26 assembly. Will try to *fix* the compiler rather than use assembly 27 language workarounds. 28- Extensive unit testing and standards conformance testing. 29 30Why a new C Standard Library? 31============================= 32 33Implementing a libc is no small task and is not be taken lightly. A 34natural question to ask is, "why a new implementation of the C 35standard library?" Some of the major reasons are as follows: 36 37- Rather than being built as a single monolithic codebase, llvm-libc is designed 38 from the beginning to enable picking and choosing pieces. This allows using 39 it as a minimum overlay for e.g. faster math functions than might be 40 available on the system library. This is useful where an application may 41 need to access improved CPU support over what's available on the system, 42 or may need guarantees in performance across different installs. 43- Explicit support for building llvm-libc and code with sanitizer compiler 44 options. 45- `Fuzzing`__ 46- Be useful for research and review. By avoiding assembly language, using C++ 47 iterators, RAII and templates, llvm-libc aims to have clearly 48 readable code and to improve the compiler as needed to ensure that optimal 49 assembly is emitted. 50- Enable fully static compiles. 51 52.. __: https://github.com/llvm/llvm-project/tree/main/libc/fuzzing 53 54Platform Support 55================ 56 57Most development is currently targeting x86_64 and aarch64 on Linux. Several 58functions in llvm-libc have been tested on Windows. The Fuchsia platform is 59slowly replacing functions from its bundled libc with functions from llvm-libc. 60 61ABI Compatibility 62================= 63 64llvm-libc is written to be ABI independent. Interfaces are generated using 65LLVM's tablegen, so supporting arbitrary ABIs is possible. In it's initial 66stages llvm-libc is not offering ABI stability in any form. 67 68Other Interesting Documentation 69=============================== 70 71.. toctree:: 72 73 build_system 74 clang_tidy_checks 75 entrypoints 76 fuzzing 77 ground_truth_specification 78 header_generation 79 implementation_standard 80 api_test 81 layering 82 mechanics_of_public_api 83 redirectors 84 source_layout 85 strings 86 runtimes_build 87