1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_third_party_llvm_libc: 2*61c4878aSAndroid Build Coastguard Worker 3*61c4878aSAndroid Build Coastguard Worker========= 4*61c4878aSAndroid Build Coastguard WorkerLLVM libc 5*61c4878aSAndroid Build Coastguard Worker========= 6*61c4878aSAndroid Build Coastguard WorkerThe ``$dir_pw_third_party/llvm_libc/`` module provides various helpers to 7*61c4878aSAndroid Build Coastguard Workeroptionally use LLVM libc with :ref:`module-pw_libc`. 8*61c4878aSAndroid Build Coastguard Worker 9*61c4878aSAndroid Build Coastguard Worker------------------------ 10*61c4878aSAndroid Build Coastguard WorkerUsing upstream LLVM libc 11*61c4878aSAndroid Build Coastguard Worker------------------------ 12*61c4878aSAndroid Build Coastguard WorkerIf you want to use LLVM libc, you must do the following: 13*61c4878aSAndroid Build Coastguard Worker 14*61c4878aSAndroid Build Coastguard WorkerSubmodule 15*61c4878aSAndroid Build Coastguard Worker========= 16*61c4878aSAndroid Build Coastguard WorkerAdd LLVM libc to your workspace with the following command. 17*61c4878aSAndroid Build Coastguard Worker 18*61c4878aSAndroid Build Coastguard Worker.. code-block:: sh 19*61c4878aSAndroid Build Coastguard Worker 20*61c4878aSAndroid Build Coastguard Worker git submodule add https://llvm.googlesource.com/llvm-project/libc \ 21*61c4878aSAndroid Build Coastguard Worker third_party/llvm_libc/src 22*61c4878aSAndroid Build Coastguard Worker 23*61c4878aSAndroid Build Coastguard WorkerNote, this git repository is maintained by Google and is a slice of upstream 24*61c4878aSAndroid Build Coastguard WorkerLLVM including only the libc subdirectory. 25*61c4878aSAndroid Build Coastguard Worker 26*61c4878aSAndroid Build Coastguard WorkerGN 27*61c4878aSAndroid Build Coastguard Worker== 28*61c4878aSAndroid Build Coastguard Worker* Set the GN var ``dir_pw_third_party_llvm_libc`` to the location of the LLVM 29*61c4878aSAndroid Build Coastguard Worker libc source. If you used the command above, this will be 30*61c4878aSAndroid Build Coastguard Worker ``//third_party/llvm_libc/src`` 31*61c4878aSAndroid Build Coastguard Worker 32*61c4878aSAndroid Build Coastguard Worker This can be set in your args.gn or .gn file like: 33*61c4878aSAndroid Build Coastguard Worker ``dir_pw_third_party_llvm_libc = "//third_party/llvm_libc_src"`` 34*61c4878aSAndroid Build Coastguard Worker 35*61c4878aSAndroid Build Coastguard Worker------ 36*61c4878aSAndroid Build Coastguard WorkerStatus 37*61c4878aSAndroid Build Coastguard Worker------ 38*61c4878aSAndroid Build Coastguard WorkerCurrently, pw_libc's llvm-libc integration only provides a pw_libc.a and is 39*61c4878aSAndroid Build Coastguard Workernot suitable as a full replacment for libc. Not all functions used by 40*61c4878aSAndroid Build Coastguard Workerprojects are currently available to use from llvm-libc. Moreover, headers are 41*61c4878aSAndroid Build Coastguard Workerprovided from the sysroot libc. Startup files are also provided from the 42*61c4878aSAndroid Build Coastguard Workersysroot. 43*61c4878aSAndroid Build Coastguard Worker 44*61c4878aSAndroid Build Coastguard WorkerIn the future, we hope to be able to fully replace the sysroot libc. 45