Skip to content

Commit 6b4ee56

Browse files
author
Siva Chandra Reddy
committed
[libc] Add a doc describing the current status of libc runtimes build.
A section briefly mentioning the planned future enhancements has also been included. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D123761
1 parent 1e23175 commit 6b4ee56

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

libc/docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,4 @@ Other Interesting Documentation
8383
redirectors
8484
source_layout
8585
strings
86+
runtimes_build

libc/docs/runtimes_build.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Building libc using the runtimes build setup
2+
============================================
3+
4+
The runtimes build of the LLVM toolchain first builds clang and then builds the
5+
various runtimes (like ``libc++`` and ``compiler-rt``) and LLVM binutils (like
6+
``llvm-objcopy`` and ``llvm-readelf``) using the freshly built clang. One can
7+
build libc also as in the same manner. As of this writing, only the ABI agnostic
8+
parts of the libc are included when built in that manner. This allows interested
9+
users to continue using their system libc's headers while linking to LLVM libc's
10+
implementations when they are available. To build libc using the runtimes build
11+
setup, one needs to include the ``libc`` project in the list of the enabled
12+
runtimes when configuring the build:
13+
14+
.. code-block:: shell
15+
16+
$> cmake ../llvm -GNinja -DLLVM_ENABLE_PROJECTS="llvm;clang" \
17+
-DLLVM_ENABLE_RUNTIMES=libc
18+
19+
Note that Ninja is used as the generator in the above CMake command. Hence, to
20+
actually build the libc, one has to build the Ninja target named ``llvmlibc``:
21+
22+
.. code-block:: shell
23+
24+
$> ninja llvmlibc
25+
26+
If a different generator is used, then the build command should be suitably
27+
adapted to build the target ``llvmlibc``. Building that target will produce a
28+
static archive which includes all ABI agnostic functions available in LLVM libc.
29+
30+
Future direction
31+
----------------
32+
33+
We plan to enhance the runtimes build of LLVM libc to include ABI sensitive
34+
parts and to also generate the public headers. Likewise, we would like to
35+
provide an option to build other runtimes like ``libc++`` and ``compiler-rt``
36+
against LLVM libc.

0 commit comments

Comments
 (0)