Skip to content

//ll:toolchain.bzl

This file declares the ll_toolchain rule.

ll_toolchain

ll_toolchain(name, LL_AMD_INCLUDES, LL_AMD_LIBRARIES, LL_CFLAGS, LL_CUDA_DRIVER, LL_CUDA_NVCC,
             LL_CUDA_NVCC_CFLAGS, LL_CUDA_NVCC_LDFLAGS, LL_CUDA_TOOLKIT, LL_DYNAMIC_LINKER,
             LL_LDFLAGS, address_sanitizer, archiver, bitcode_linker, builtin_includes, c_driver,
             clang_tidy, clang_tidy_runner, compiler_runtime, cov, cpp_abihdrs, cpp_abilib,
             cpp_driver, cpp_stdhdrs, cpp_stdlib, hip_libraries, hip_runtime, leak_sanitizer, linker,
             linker_wrapper, llvm_project_deps, machine_code_tool, memory_sanitizer, objcopy,
             offload_bundler, offload_packager, opt, profdata, profile, rocm_device_libs, symbolizer,
             thread_sanitizer, undefined_behavior_sanitizer, unwind_library)

attributes

Name Description
name Name, required.

A unique name for this target.
LL_AMD_INCLUDES Label, optional, defaults to None.

System includes for dependencies making use of AMD toolchains.

Affects the hip_amdgpu and hip_nvptx toolchains.
LL_AMD_LIBRARIES Label, optional, defaults to None.

Link search paths for dependencies making use of AMD toolchains.

Affects the hip_amdgpu toolchain.
LL_CFLAGS Label, optional, defaults to None.

Arbitrary flags added to all compile actions.
LL_CUDA_DRIVER Label, optional, defaults to None.

The path to the CUDA driver.

Affects the cuda_nvptx and hip_nvptx toolchains.
LL_CUDA_NVCC Label, optional, defaults to None.

The path to the nvcc compiler.

Affects the cuda_nvptx_nvcc toolchain. Other *_nvptx toolchains use the c_driver or cpp_driver as device compiler.
LL_CUDA_NVCC_CFLAGS Label, optional, defaults to None.

Compile flags used by the cuda_nvptx_nvcc toolchain.
LL_CUDA_NVCC_LDFLAGS Label, optional, defaults to None.

Link flags used by the cuda_nvptx_nvcc toolchain.
LL_CUDA_TOOLKIT Label, optional, defaults to None.

The path to the CUDA toolkit.

Affects the cuda_nvptx and hip_nvptx toolchains.
LL_DYNAMIC_LINKER Label, optional, defaults to None.

The linker from the glibc we compile and link against.
LL_LDFLAGS Label, optional, defaults to None.

Arbitrary flags added to all link actions.
address_sanitizer List of labels, optional, defaults to [].

AddressSanitizer libraries.
archiver Label, optional, defaults to "@llvm-project//llvm:llvm-ar".

The archiver.
bitcode_linker Label, optional, defaults to "@llvm-project//llvm:llvm-link".

The linker for LLVM bitcode files.
builtin_includes Label, optional, defaults to "@llvm-project//clang:builtin_headers_gen".

Clang's built-in header files.
c_driver Label, optional, defaults to "@llvm-project//clang".

The C compiler driver.
clang_tidy Label, optional, defaults to "@llvm-project//clang-tools-extra/clang-tidy".

The clang-tidy binary.
clang_tidy_runner Label, optional, defaults to "@llvm-project//clang-tools-extra/clang-tidy:run-clang-tidy".

The run-clang-tidy.py wrapper script for clang-tidy.
compiler_runtime List of labels, optional, defaults to [].

The compiler runtime.
cov Label, optional, defaults to "@llvm-project//llvm:llvm-cov".

The llvm-cov tool.
cpp_abihdrs Label, optional, defaults to None.

The C++ ABI headers.
cpp_abilib Label, optional, defaults to None.

The C++ ABI library archive.
cpp_driver Label, optional, defaults to "@llvm-project//clang:clang++".

The C++ compiler driver.
cpp_stdhdrs Label, optional, defaults to None.

The C++ standard library headers.
cpp_stdlib Label, optional, defaults to None.

The C++ standard library.
hip_libraries List of labels, optional, defaults to [].

The HIP libraries.

rules_ll still uses clang to compile device code.

Using this implies acceptance of the AMD's license for HIP.

Using HIP to target Nvidia devices implies use of the Nvidia CUDA toolkit.
hip_runtime List of labels, optional, defaults to [].

The libamdhip64 runtime.
leak_sanitizer List of labels, optional, defaults to [].

LeakSanitizer libraries.
linker Label, optional, defaults to "@llvm-project//lld".

The linker.

Called by the clang-linker-wrapper.
linker_wrapper Label, optional, defaults to "@llvm-project//clang:clang-linker-wrapper".

The clang-linker-wrapper.

This wraps the host linker and the device linkers.
llvm_project_deps List of labels, optional, defaults to ["@llvm-project//clang:analysis", "@llvm-project//clang:apinotes", "@llvm-project//clang:arc_migrate", "@llvm-project//clang:ast", "@llvm-project//clang:ast-diff", "@llvm-project//clang:ast_matchers", "@llvm-project//clang:ast_matchers_dynamic", "@llvm-project//clang:basic", "@llvm-project//clang:clang-driver", "@llvm-project//clang:codegen", "@llvm-project//clang:config", "@llvm-project//clang:crosstu", "@llvm-project//clang:driver", "@llvm-project//clang:edit", "@llvm-project//clang:extract_api", "@llvm-project//clang:format", "@llvm-project//clang:frontend", "@llvm-project//clang:frontend_rewrite", "@llvm-project//clang:frontend_tool", "@llvm-project//clang:index", "@llvm-project//clang:install_api", "@llvm-project//clang:interpreter", "@llvm-project//clang:lex", "@llvm-project//clang:libclang", "@llvm-project//clang:libclang_static", "@llvm-project//clang:parse", "@llvm-project//clang:rewrite", "@llvm-project//clang:sema", "@llvm-project//clang:serialization", "@llvm-project//clang:static_analyzer_checkers", "@llvm-project//clang:static_analyzer_core", "@llvm-project//clang:static_analyzer_core_options", "@llvm-project//clang:static_analyzer_frontend", "@llvm-project//clang:support", "@llvm-project//clang:tooling", "@llvm-project//clang:tooling_core", "@llvm-project//clang:tooling_dependency_scanning", "@llvm-project//clang:tooling_inclusions", "@llvm-project//clang:tooling_refactoring", "@llvm-project//clang:tooling_syntax", "@llvm-project//clang:transformer", "@llvm-project//llvm:AggressiveInstCombine", "@llvm-project//llvm:AllTargetsAsmParsers", "@llvm-project//llvm:AllTargetsCodeGens", "@llvm-project//llvm:AllTargetsDisassemblers", "@llvm-project//llvm:AllTargetsMCAs", "@llvm-project//llvm:Analysis", "@llvm-project//llvm:AsmParser", "@llvm-project//llvm:BinaryFormat", "@llvm-project//llvm:BitReader", "@llvm-project//llvm:BitWriter", "@llvm-project//llvm:BitstreamReader", "@llvm-project//llvm:BitstreamWriter", "@llvm-project//llvm:CFGuard", "@llvm-project//llvm:CodeGen", "@llvm-project//llvm:CodeGenTypes", "@llvm-project//llvm:Core", "@llvm-project//llvm:Coroutines", "@llvm-project//llvm:Coverage", "@llvm-project//llvm:DWP", "@llvm-project//llvm:DebugInfo", "@llvm-project//llvm:DebugInfoBTF", "@llvm-project//llvm:DebugInfoCodeView", "@llvm-project//llvm:DebugInfoDWARF", "@llvm-project//llvm:DebugInfoGSYM", "@llvm-project//llvm:DebugInfoLogicalView", "@llvm-project//llvm:DebugInfoMSF", "@llvm-project//llvm:DebugInfoPDB", "@llvm-project//llvm:Debuginfod", "@llvm-project//llvm:Demangle", "@llvm-project//llvm:ExecutionEngine", "@llvm-project//llvm:FileCheckLib", "@llvm-project//llvm:FrontendDriver", "@llvm-project//llvm:FrontendHLSL", "@llvm-project//llvm:FrontendOffloading", "@llvm-project//llvm:FrontendOpenACC", "@llvm-project//llvm:FrontendOpenMP", "@llvm-project//llvm:HipStdPar", "@llvm-project//llvm:IPO", "@llvm-project//llvm:IRPrinter", "@llvm-project//llvm:IRReader", "@llvm-project//llvm:InstCombine", "@llvm-project//llvm:Instrumentation", "@llvm-project//llvm:InterfaceStub", "@llvm-project//llvm:Interpreter", "@llvm-project//llvm:LTO", "@llvm-project//llvm:LibDriver", "@llvm-project//llvm:LineEditor", "@llvm-project//llvm:Linker", "@llvm-project//llvm:TableGenGlobalISel", "@llvm-project//llvm:MC", "@llvm-project//llvm:MCA", "@llvm-project//llvm:MCDisassembler", "@llvm-project//llvm:MCParser", "@llvm-project//llvm:ObjCARC", "@llvm-project//llvm:Object", "@llvm-project//llvm:ObjectYAML", "@llvm-project//llvm:Option", "@llvm-project//llvm:Passes", "@llvm-project//llvm:ProfileData", "@llvm-project//llvm:Remarks", "@llvm-project//llvm:Scalar", "@llvm-project//llvm:Support", "@llvm-project//llvm:Symbolize", "@llvm-project//llvm:TableGen", "@llvm-project//llvm:Target", "@llvm-project//llvm:TargetParser", "@llvm-project//llvm:TextAPI", "@llvm-project//llvm:TransformUtils", "@llvm-project//llvm:Vectorize", "@llvm-project//llvm:WindowsDriver", "@llvm-project//llvm:attributes_gen", "@llvm-project//llvm:common_transforms", "@llvm-project//llvm:config", "@llvm-project//llvm:remark_linker", "@llvm-project//lld:ELF", "@llvm-project//lld:Common", "@zlib-ng//:zlib", "@zstd", "@llvm-project//llvm:AMDGPUCodeGen", "@llvm-project//llvm:AMDGPUDisassembler", "@llvm-project//llvm:AMDGPUAsmParser", "@llvm-project//llvm:AMDGPUTargetMCA", "@llvm-project//llvm:AMDGPUUtilsAndDesc", "@llvm-project//llvm:AMDGPUInfo", "@llvm-project//llvm:WebAssemblyCodeGen", "@llvm-project//llvm:WebAssemblyDisassembler", "@llvm-project//llvm:WebAssemblyAsmParser", "@llvm-project//llvm:WebAssemblyTargetMCA", "@llvm-project//llvm:WebAssemblyUtilsAndDesc", "@llvm-project//llvm:WebAssemblyInfo", "@llvm-project//llvm:AArch64CodeGen", "@llvm-project//llvm:AArch64Disassembler", "@llvm-project//llvm:AArch64AsmParser", "@llvm-project//llvm:AArch64TargetMCA", "@llvm-project//llvm:AArch64UtilsAndDesc", "@llvm-project//llvm:AArch64Info", "@llvm-project//llvm:BPFCodeGen", "@llvm-project//llvm:BPFDisassembler", "@llvm-project//llvm:BPFAsmParser", "@llvm-project//llvm:BPFTargetMCA", "@llvm-project//llvm:BPFUtilsAndDesc", "@llvm-project//llvm:BPFInfo", "@llvm-project//llvm:LanaiCodeGen", "@llvm-project//llvm:LanaiDisassembler", "@llvm-project//llvm:LanaiAsmParser", "@llvm-project//llvm:LanaiTargetMCA", "@llvm-project//llvm:LanaiUtilsAndDesc", "@llvm-project//llvm:LanaiInfo", "@llvm-project//llvm:MSP430CodeGen", "@llvm-project//llvm:MSP430Disassembler", "@llvm-project//llvm:MSP430AsmParser", "@llvm-project//llvm:MSP430TargetMCA", "@llvm-project//llvm:MSP430UtilsAndDesc", "@llvm-project//llvm:MSP430Info", "@llvm-project//llvm:AVRCodeGen", "@llvm-project//llvm:AVRDisassembler", "@llvm-project//llvm:AVRAsmParser", "@llvm-project//llvm:AVRTargetMCA", "@llvm-project//llvm:AVRUtilsAndDesc", "@llvm-project//llvm:AVRInfo", "@llvm-project//llvm:HexagonCodeGen", "@llvm-project//llvm:HexagonDisassembler", "@llvm-project//llvm:HexagonAsmParser", "@llvm-project//llvm:HexagonTargetMCA", "@llvm-project//llvm:HexagonUtilsAndDesc", "@llvm-project//llvm:HexagonInfo", "@llvm-project//llvm:VECodeGen", "@llvm-project//llvm:VEDisassembler", "@llvm-project//llvm:VEAsmParser", "@llvm-project//llvm:VETargetMCA", "@llvm-project//llvm:VEUtilsAndDesc", "@llvm-project//llvm:VEInfo", "@llvm-project//llvm:NVPTXCodeGen", "@llvm-project//llvm:NVPTXDisassembler", "@llvm-project//llvm:NVPTXAsmParser", "@llvm-project//llvm:NVPTXTargetMCA", "@llvm-project//llvm:NVPTXUtilsAndDesc", "@llvm-project//llvm:NVPTXInfo", "@llvm-project//llvm:XCoreCodeGen", "@llvm-project//llvm:XCoreDisassembler", "@llvm-project//llvm:XCoreAsmParser", "@llvm-project//llvm:XCoreTargetMCA", "@llvm-project//llvm:XCoreUtilsAndDesc", "@llvm-project//llvm:XCoreInfo", "@llvm-project//llvm:X86CodeGen", "@llvm-project//llvm:X86Disassembler", "@llvm-project//llvm:X86AsmParser", "@llvm-project//llvm:X86TargetMCA", "@llvm-project//llvm:X86UtilsAndDesc", "@llvm-project//llvm:X86Info", "@llvm-project//llvm:RISCVCodeGen", "@llvm-project//llvm:RISCVDisassembler", "@llvm-project//llvm:RISCVAsmParser", "@llvm-project//llvm:RISCVTargetMCA", "@llvm-project//llvm:RISCVUtilsAndDesc", "@llvm-project//llvm:RISCVInfo", "@llvm-project//llvm:MipsCodeGen", "@llvm-project//llvm:MipsDisassembler", "@llvm-project//llvm:MipsAsmParser", "@llvm-project//llvm:MipsTargetMCA", "@llvm-project//llvm:MipsUtilsAndDesc", "@llvm-project//llvm:MipsInfo", "@llvm-project//llvm:PowerPCCodeGen", "@llvm-project//llvm:PowerPCDisassembler", "@llvm-project//llvm:PowerPCAsmParser", "@llvm-project//llvm:PowerPCTargetMCA", "@llvm-project//llvm:PowerPCUtilsAndDesc", "@llvm-project//llvm:PowerPCInfo", "@llvm-project//llvm:SystemZCodeGen", "@llvm-project//llvm:SystemZDisassembler", "@llvm-project//llvm:SystemZAsmParser", "@llvm-project//llvm:SystemZTargetMCA", "@llvm-project//llvm:SystemZUtilsAndDesc", "@llvm-project//llvm:SystemZInfo", "@llvm-project//llvm:ARMCodeGen", "@llvm-project//llvm:ARMDisassembler", "@llvm-project//llvm:ARMAsmParser", "@llvm-project//llvm:ARMTargetMCA", "@llvm-project//llvm:ARMUtilsAndDesc", "@llvm-project//llvm:ARMInfo", "@llvm-project//llvm:SparcCodeGen", "@llvm-project//llvm:SparcDisassembler", "@llvm-project//llvm:SparcAsmParser", "@llvm-project//llvm:SparcTargetMCA", "@llvm-project//llvm:SparcUtilsAndDesc", "@llvm-project//llvm:SparcInfo"].

Targets from the llvm-project-overlay.

Useful for targets that depend on the llvm-project. For instance frontend actions and Clang plugins.
machine_code_tool Label, optional, defaults to "@llvm-project//llvm:llvm-mc".

The llvm-mc tool.

Used when building CUDA and HIP with -fgpu-rdc..
memory_sanitizer List of labels, optional, defaults to [].

MemorySanitizer libraries.
objcopy Label, optional, defaults to "@llvm-project//llvm:llvm-objcopy".

The llvm-objcopy tool.
offload_bundler Label, optional, defaults to "@llvm-project//clang:clang-offload-bundler".

The clang-offload-bundler.

Bundles the device code objects for GPU code.
offload_packager Label, optional, defaults to "@llvm-project//clang:clang-offload-packager".

The clang-offload-packager.
opt Label, optional, defaults to "@llvm-project//llvm:opt".

The LLVM opt tool.
profdata Label, optional, defaults to "@llvm-project//llvm:llvm-profdata".

The llvm-profdata tool.
profile Label, optional, defaults to None.

The clang_rt.profile implementation
rocm_device_libs Label, optional, defaults to None.

The ROCm-Device-Libs.
symbolizer Label, optional, defaults to "@llvm-project//llvm:llvm-symbolizer".

The llvm-symbolizer.
thread_sanitizer List of labels, optional, defaults to [].

ThreadSanitizer libraries.
undefined_behavior_sanitizer List of labels, optional, defaults to [].

UndefinedBehaviorSanitizer libraries.
unwind_library Label, optional, defaults to None.

The unwinder library.