1.. _module-pw_toolchain: 2 3================ 4LLVM compiler-rt 5================ 6The ``$dir_pw_third_party/llvm_builtins/`` directory provides the GN integration 7necessary to link against LLVM compiler-rt project. The intention here is to use 8the builtins provided by the LLVM compiler-rt project. 9 10------------------------------- 11Using upstream LLVM compiler-rt 12------------------------------- 13If you want to use LLVM compiler-rt, you must do the following: 14 15Submodule 16========= 17Add LLVM compiler-rt to your workspace with the following command. 18 19.. code-block:: sh 20 21 git submodule add git submodule add \ 22 https://llvm.googlesource.com/llvm-project/compiler-rt \ 23 third_party/llvm_builtins 24 25.. admonition:: Note 26 27 This git repository is maintained by Google and is a slice of upstream 28 LLVM including only the compiler-rt subdirectory. 29 30GN 31== 32* Set the GN var ``dir_pw_third_party_llvm_builtins`` to the location of the 33 LLVM compiler-rt source. If you used the command above, this will be 34 ``//third_party/llvm_builtins`` 35 36 This can be set in your args.gn or .gn file like: 37 ``dir_pw_third_party_llvm_builtins = "//third_party/llvm_builtins"`` 38 39* Set the ``pw_third_party_llvm_builtins_TARGET_BUILTINS`` to the pw_source_set 40 that selectively adds the files required for the given architecture from the 41 LLVM compiler-rt checkout directory. 42 43 For example, you can add the following in your args.gn or .gn file to use the 44 builtins for ARMv7-M targets. 45 46 .. code-block:: 47 48 pw_third_party_llvm_builtins_TARGET_BUILTINS = "$dir_pw_third_party/llvm_builtins:arm_builtins_armv7m" 49 50* Set the optional ``pw_third_party_llvm_builtins_ignore_list`` to the list of 51 files included in pw_source_sets in ``$dir_pw_third_party/llvm_builtins/BUILD.gn`` file. 52