xref: /aosp_15_r20/external/pigweed/third_party/llvm_libc/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_third_party_llvm_libc:
2
3=========
4LLVM libc
5=========
6The ``$dir_pw_third_party/llvm_libc/`` module provides various helpers to
7optionally use LLVM libc with :ref:`module-pw_libc`.
8
9------------------------
10Using upstream LLVM libc
11------------------------
12If you want to use LLVM libc, you must do the following:
13
14Submodule
15=========
16Add LLVM libc to your workspace with the following command.
17
18.. code-block:: sh
19
20   git submodule add https://llvm.googlesource.com/llvm-project/libc \
21     third_party/llvm_libc/src
22
23Note, this git repository is maintained by Google and is a slice of upstream
24LLVM including only the libc subdirectory.
25
26GN
27==
28* Set the GN var ``dir_pw_third_party_llvm_libc`` to the location of the LLVM
29  libc source. If you used the command above, this will be
30  ``//third_party/llvm_libc/src``
31
32  This can be set in your args.gn or .gn file like:
33  ``dir_pw_third_party_llvm_libc = "//third_party/llvm_libc_src"``
34
35------
36Status
37------
38Currently, pw_libc's llvm-libc integration only provides a pw_libc.a and is
39not suitable as a full replacment for libc. Not all functions used by
40projects are currently available to use from llvm-libc. Moreover, headers are
41provided from the sysroot libc. Startup files are also provided from the
42sysroot.
43
44In the future, we hope to be able to fully replace the sysroot libc.
45