Contributing to the libc Project#
LLVM-libc is being developed as part of the LLVM project so contributions to the libc project should also follow the general LLVM contribution guidelines. Below is a list of open projects that one can start with:
Beginner Bugs - Help us tackle good first issues. These bugs have been tagged with the github labels “libc” and “good first issue” by the team as potentially easier places to get started. Please do first check if the bug has an assignee; if so please find another unless there’s been no movement on the issue from the assignee, in which place do ask if you can help take over. Remember to follow the LLVM AI Tool Use Policy which forbids using LLMs for good first issues.
Cleanup code-style - The libc project follows the general LLVM style with specific conventions for naming (
snake_casefor functions,CamelCasefor types). See the code style page for the authoritative reference. Mechanical projects to move parts following old styles to the current conventions are welcome.Implement Linux syscall wrappers - A large portion of the POSIX API can be implemented as syscall wrappers on Linux. A good number have already been implemented but many more are yet to be implemented. So, a project of medium complexity would be to implement syscall wrappers which have not yet been implemented.
Update the clang-tidy lint rules and use them in the build and/or CI - The libc project has a set of clang-tidy checks (see clang-tidy checks) but they are not enabled by default. They can be enabled by configuring with
-DLLVM_LIBC_ENABLE_LINTING=ON(or by settingLLVM_LIBC_CLANG_TIDY) and running thelibc-lintbuild target. This project is about keeping the checks up to date and reintegrating them into the build and CI.double and higher precision math functions - These are under active development but you can take a shot at those not yet implemented. See Math Functions for more information.
Contribute a new OS/Architecture port - You can contribute a new operating system or target architecture port. See Bringup on a New OS or Architecture for more information.
Before you start#
Read Design Philosophy and ABI and Public Header Policy to understand what the project is and is not trying to do. Read Implementation Guidelines for how code is expected to be written, and Common Mistakes and Legacy Patterns before modelling new code on something that is already in the tree, because older code does not always follow the current conventions.
Some changes are worth discussing with the maintainers before investing in an implementation:
a non-trivial change to the layout of an existing public type or the value of an existing public macro, or exporting a symbol under a name other than its standard one (see ABI and Public Header Policy),
a function that is not in the C or POSIX standards,
a new configuration option,
new code under
libc/shared/, or a new user of it,any code written in assembly (see Policy on Assembly sources),
any intentional deviation from a standard.
The easiest way to reach out is to ask in the #libc channel on the
LLVM Discord.
Pull requests#
Keep pull requests small and focused. Add one function, or one closely related family of functions, per pull request. Land refactoring separately from the change that needs it. A bug found along the way gets its own pull request.
Title. Start the title with
[libc], and add a second tag where one applies:[libc][math],[libc][docs], or[libc][NFC]for changes with no functional effect.Format the change. Run
clang-formaton C++ sources andlibc/utils/cmake_format.py -ion the CMake files you edited.Test in both build modes where the code supports both. See Testing Guide.
Do not mention people with
@in commit messages, or in a pull request description that will become one. GitHub notifies them again each time the commit is pushed to another fork. Request reviews through the reviewers field instead.Bazel. Updating the Bazel build files is not required, but it is appreciated.
LLVM-libc follows LLVM’s patch reversion policy. A change that breaks a buildbot is reverted or, if the fix is trivial, fixed forward. When relanding, describe what went wrong and how it was fixed.
AI-assisted contributions#
LLVM’s AI Tool Use Policy applies to LLVM-libc. Read it before using AI tools on a contribution.
Tools make some mistakes in this project more often than people do:
They imitate the code around them, including code that follows outdated conventions. See Common Mistakes and Legacy Patterns.
Asked to make a program work, they change LLVM-libc’s types, symbols, or behavior to match another libc, because that is the shortest path to a passing build. See Making existing software work.
They reproduce code from other C libraries. That is not allowed, regardless of how the code was produced. See Original implementations only.
They call one public function from another. See Entrypoints do not call entrypoints.
Check for these before asking for review.