blob: 15da26fb860c6ae10bd2491ee89c7879a9e4f4e0 [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
declare_args() {
# This directory contains the cipd packages for linux-x64, linux-arm64, and
# mac-x64. Rather than using the prebuilts provided with the source tree, you
# can download these individual packages from cipd and set this to the directory
# containing those packages.
llvm_prefix = "//prebuilt/third_party/llvm"
}
# Soft transition when rolling LLVM with API changes. Clients can use LLVM_USING_OLD_PREBUILT macro
# to detect the LLVM version.
#
# To enable during soft transitions , set the condition to true to enable the
# checking, and update the old_prebuilt_instance_ids to the old version you want
# to detect. Otherwise this condition should be false.
if (true) {
prebuilt_cipd_version =
read_file("${llvm_prefix}/${host_platform}/.versions/llvm.cipd_version",
"json")
prebuilt_instance_id = prebuilt_cipd_version.instance_id
old_prebuilt_instance_ids = [
"YLA3-L3DfwImnY-bZ1oAEl3B6anO5dz1LMhSsiF7l7UC", # linux-amd64
"ke6AnH4NtJ8SnhpX9sfCwGJKFFDCTNbaWJzLxOeCYkkC", # linux-arm64
"JhfSTBh7lzST9p5tPypiYKwYOfcbXnMFNA9jluclYoMC", # mac-amd64
"9g5EChWXrTRWNiVpKBRQ-mazvSkQ034yYONFQxdw_CgC", # mac-arm64
]
using_old_prebuilt = old_prebuilt_instance_ids + [ prebuilt_instance_id ] -
[ prebuilt_instance_id ] != old_prebuilt_instance_ids
} else {
using_old_prebuilt = false
}
config("LLVM_config") {
visibility = [ ":*" ]
include_dirs = [ "${llvm_prefix}/${current_platform}/include" ]
if (current_os == "linux") {
libs = [ "${llvm_prefix}/${current_platform}/lib/libLLVM.so" ]
} else if (current_os == "mac") {
libs = [ "${llvm_prefix}/${current_platform}/lib/libLLVM.dylib" ]
}
if (using_old_prebuilt) {
defines = [ "LLVM_USING_OLD_PREBUILT" ]
}
}
# Shared library
group("LLVM") {
public_configs = [ ":LLVM_config" ]
}
config("LLVMHeader_config") {
# elflib depends on LLVM headers and is compiled on target. Since we don't have Fuchsia variant
# of LLVM library yet, always use host_platform's include directory for now.
# It should make no difference as headers are the same across different platforms.
# Use -isystem instead of -I to suppress -Wconversion warnings in those headers.
cflags = [ "-isystem" + rebase_path("${llvm_prefix}/${host_platform}/include",
root_build_dir) ]
if (using_old_prebuilt) {
defines = [ "LLVM_USING_OLD_PREBUILT" ]
}
}
template("llvm_library") {
config(target_name + "_config") {
visibility = [ ":*" ]
libs = [ "${llvm_prefix}/${current_platform}/lib/lib${target_name}.a" ]
}
group(target_name) {
forward_variables_from(invoker, [ "deps" ])
public_configs = [
":LLVMHeader_config",
":${target_name}_config",
]
# LLVM prebuilts are currently not built with RTTI, so if UBSan is enabled,
# we should make sure RTTI vptr checks should not be done on these libraries
# and anyone who depends on these libraries.
# Note that this doesn't remove the rtti config (or the -frtti flag), but
# this works because inherited configs will apply after the config set on the
# target, so the last RTTI setting on the command line wins.
public_configs += [ "//build/config:no_rtti" ]
# ASan will report false positives for container overflow detection because
# LLVM is prebuilt without ASan.
if (!defined(deps)) {
deps = []
}
deps += [
"//build/config/sanitizers:suppress-asan-container-overflow",
"//third_party/zlib:zlib_static",
"//third_party/zstd:zstd",
]
}
}
# The following dependency graph could be obtained by
# 1. Download llvm/utils/GenLibDeps.pl from LLVM codebase.
# 2. GenLibDeps.pl -flat prebuilt/third_party/llvm/lib | python3 convert_deps.py
# Sometimes when rolling, the dependency graph for the libraries changes. It
# then becomes necessary to check the `using_old_prebuilt` flag to soft
# transition the build graph.
#
# To update, copy all of the llvm_library instances below into an
# `if (using_old_prebuilt) { ... }` and an `else {...}` branch. Update the
# contents of the else branch to the if branch. Then make any necessary changes
# to the else branch for the new version.
llvm_library("LLVMAArch64Desc") {
deps = [
":LLVMAArch64Info",
":LLVMAArch64Utils",
":LLVMBinaryFormat",
":LLVMMC",
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMAArch64Disassembler") {
deps = [
":LLVMAArch64Desc",
":LLVMAArch64Info",
":LLVMAArch64Utils",
":LLVMMC",
":LLVMMCDisassembler",
":LLVMSupport",
]
}
llvm_library("LLVMAArch64Info") {
deps = [
":LLVMMC",
":LLVMSupport",
]
}
llvm_library("LLVMAArch64Utils") {
deps = [
":LLVMCore",
":LLVMSupport",
]
}
llvm_library("LLVMAnalysis") {
deps = [
":LLVMBinaryFormat",
":LLVMCore",
":LLVMObject",
":LLVMProfileData",
":LLVMSupport",
]
}
llvm_library("LLVMAggressiveInstCombine") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMSupport",
":LLVMTransformUtils",
]
}
llvm_library("LLVMAsmParser") {
deps = [
":LLVMBinaryFormat",
":LLVMCore",
":LLVMSupport",
]
}
llvm_library("LLVMAsmPrinter") {
deps = [
":LLVMAnalysis",
":LLVMBinaryFormat",
":LLVMCodeGen",
":LLVMCore",
":LLVMDebugInfoCodeView",
":LLVMDebugInfoDWARF",
":LLVMDebugInfoMSF",
":LLVMMC",
":LLVMMCParser",
":LLVMRemarks",
":LLVMSupport",
":LLVMTarget",
]
}
llvm_library("LLVMBinaryFormat") {
deps = [
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMBitReader") {
deps = [
":LLVMBitstreamReader",
":LLVMCore",
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMBitWriter") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMMC",
":LLVMObject",
":LLVMSupport",
]
}
llvm_library("LLVMBitstreamReader") {
deps = [ ":LLVMSupport" ]
}
llvm_library("LLVMCodeGen") {
deps = [
":LLVMAnalysis",
":LLVMBitReader",
":LLVMBitWriter",
":LLVMCore",
":LLVMMC",
":LLVMProfileData",
":LLVMScalarOpts",
":LLVMSupport",
":LLVMTarget",
":LLVMTransformUtils",
]
}
llvm_library("LLVMCFGuard") {
deps = [
":LLVMCore",
":LLVMSupport",
]
}
llvm_library("LLVMCodeGenTypes") {
deps = [ ":LLVMSupport" ]
}
llvm_library("LLVMCore") {
deps = [
":LLVMBinaryFormat",
":LLVMDemangle",
":LLVMRemarks",
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMCoroutines") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMScalarOpts",
":LLVMSupport",
":LLVMTransformUtils",
":LLVMipo",
]
}
llvm_library("LLVMDebugInfoCodeView") {
deps = [ ":LLVMSupport" ]
}
llvm_library("LLVMDebugInfoDWARF") {
deps = [
":LLVMBinaryFormat",
":LLVMObject",
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMDebugInfoMSF") {
deps = [ ":LLVMSupport" ]
}
llvm_library("LLVMDebugInfoPDB") {
deps = [
":LLVMBinaryFormat",
":LLVMDebugInfoCodeView",
":LLVMDebugInfoMSF",
":LLVMObject",
":LLVMSupport",
]
}
llvm_library("LLVMDemangle") {
deps = []
}
llvm_library("LLVMExecutionEngine") {
deps = [
":LLVMCore",
":LLVMMC",
":LLVMObject",
":LLVMOrcTargetProcess",
":LLVMRuntimeDyld",
":LLVMSupport",
":LLVMTarget",
]
}
llvm_library("LLVMFrontendOffloading") {
deps = [
":LLVMCore",
":LLVMSupport",
":LLVMTargetParser",
":LLVMTransformUtils",
]
}
llvm_library("LLVMFrontendOpenMP") {
deps = [
":LLVMAnalysis",
":LLVMBitReader",
":LLVMCore",
":LLVMFrontendOffloading",
":LLVMMC",
":LLVMScalarOpts",
":LLVMSupport",
":LLVMTargetParser",
":LLVMTransformUtils",
]
}
llvm_library("LLVMGlobalISel") {
deps = [
":LLVMAnalysis",
":LLVMCodeGen",
":LLVMCore",
":LLVMMC",
":LLVMSelectionDAG",
":LLVMSupport",
":LLVMTarget",
":LLVMTransformUtils",
]
}
llvm_library("LLVMHipStdPar") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMSupport",
":LLVMTransformUtils",
]
}
llvm_library("LLVMInstCombine") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMSupport",
":LLVMTransformUtils",
]
}
llvm_library("LLVMInstrumentation") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMDemangle",
":LLVMMC",
":LLVMProfileData",
":LLVMSupport",
":LLVMTransformUtils",
]
}
llvm_library("LLVMipo") {
deps = [
":LLVMAggressiveInstCombine",
":LLVMAnalysis",
":LLVMBitReader",
":LLVMBitWriter",
":LLVMCore",
":LLVMFrontendOpenMP",
":LLVMIRReader",
":LLVMInstCombine",
":LLVMInstrumentation",
":LLVMLinker",
":LLVMObject",
":LLVMProfileData",
":LLVMScalarOpts",
":LLVMSupport",
":LLVMTransformUtils",
":LLVMVectorize",
]
}
llvm_library("LLVMIRPrinter") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMSupport",
]
}
llvm_library("LLVMIRReader") {
deps = [
":LLVMAsmParser",
":LLVMBitReader",
":LLVMCore",
":LLVMSupport",
]
}
llvm_library("LLVMLinker") {
deps = [
":LLVMCore",
":LLVMObject",
":LLVMSupport",
":LLVMTransformUtils",
]
}
llvm_library("LLVMMC") {
deps = [
":LLVMBinaryFormat",
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMMCDisassembler") {
deps = [
":LLVMMC",
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMMCJIT") {
deps = [
":LLVMCore",
":LLVMExecutionEngine",
":LLVMObject",
":LLVMRuntimeDyld",
":LLVMSupport",
":LLVMTarget",
]
}
llvm_library("LLVMMCParser") {
deps = [
":LLVMMC",
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMObjCARCOpts") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMSupport",
":LLVMTransformUtils",
]
}
llvm_library("LLVMObject") {
deps = [
":LLVMBinaryFormat",
":LLVMBitReader",
":LLVMCore",
":LLVMIRReader",
":LLVMMC",
":LLVMMCParser",
":LLVMSupport",
":LLVMTargetParser",
":LLVMTextAPI",
]
}
llvm_library("LLVMOrcShared") {
deps = [ ":LLVMSupport" ]
}
llvm_library("LLVMOrcTargetProcess") {
deps = [
":LLVMOrcShared",
":LLVMSupport",
]
}
llvm_library("LLVMPasses") {
deps = [
":LLVMAggressiveInstCombine",
":LLVMAnalysis",
":LLVMCore",
":LLVMCoroutines",
":LLVMHipStdPar",
":LLVMInstCombine",
":LLVMInstrumentation",
":LLVMObjCARCOpts",
":LLVMScalarOpts",
":LLVMSupport",
":LLVMTarget",
":LLVMTransformUtils",
":LLVMVectorize",
":LLVMipo",
]
}
llvm_library("LLVMProfileData") {
deps = [
":LLVMCore",
":LLVMDebugInfoDWARF",
":LLVMDemangle",
":LLVMObject",
":LLVMSupport",
":LLVMSymbolize",
]
}
if (using_old_prebuilt) {
group("LLVMRISCVDesc") {
}
group("LLVMRISCVDisassembler") {
}
group("LLVMRISCVInfo") {
}
} else {
llvm_library("LLVMRISCVDesc") {
deps = [
":LLVMMC",
":LLVMRISCVInfo",
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMRISCVDisassembler") {
deps = [
":LLVMMC",
":LLVMMCDisassembler",
":LLVMRISCVDesc",
":LLVMRISCVInfo",
":LLVMSupport",
]
}
llvm_library("LLVMRISCVInfo") {
deps = [
":LLVMMC",
":LLVMSupport",
]
}
}
llvm_library("LLVMRemarks") {
deps = [
":LLVMBitstreamReader",
":LLVMSupport",
]
}
llvm_library("LLVMRuntimeDyld") {
deps = [
":LLVMCore",
":LLVMMC",
":LLVMObject",
":LLVMSupport",
]
}
llvm_library("LLVMScalarOpts") {
deps = [
":LLVMAggressiveInstCombine",
":LLVMAnalysis",
":LLVMCore",
":LLVMInstCombine",
":LLVMSupport",
":LLVMTransformUtils",
]
}
llvm_library("LLVMSelectionDAG") {
deps = [
":LLVMAnalysis",
":LLVMCodeGen",
":LLVMCore",
":LLVMMC",
":LLVMSupport",
":LLVMTarget",
":LLVMTransformUtils",
]
}
llvm_library("LLVMSupport") {
deps = []
}
llvm_library("LLVMSymbolize") {
deps = [
":LLVMDebugInfoDWARF",
":LLVMDebugInfoPDB",
":LLVMDemangle",
":LLVMObject",
":LLVMSupport",
]
}
llvm_library("LLVMTarget") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMMC",
":LLVMSupport",
]
}
llvm_library("LLVMTargetParser") {
deps = [ ":LLVMSupport" ]
}
llvm_library("LLVMTextAPI") {
deps = [
":LLVMSupport",
":LLVMTargetParser",
]
}
llvm_library("LLVMTransformUtils") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMSupport",
]
}
llvm_library("LLVMVectorize") {
deps = [
":LLVMAnalysis",
":LLVMCore",
":LLVMSupport",
":LLVMTransformUtils",
]
}
llvm_library("LLVMX86CodeGen") {
deps = [
":LLVMAnalysis",
":LLVMAsmPrinter",
":LLVMCFGuard",
":LLVMCodeGen",
":LLVMCore",
":LLVMGlobalISel",
":LLVMInstrumentation",
":LLVMMC",
":LLVMProfileData",
":LLVMSelectionDAG",
":LLVMSupport",
":LLVMTarget",
":LLVMTransformUtils",
":LLVMX86Desc",
":LLVMX86Info",
]
}
llvm_library("LLVMX86Desc") {
deps = [
":LLVMBinaryFormat",
":LLVMMC",
":LLVMMCDisassembler",
":LLVMSupport",
":LLVMTargetParser",
":LLVMX86Info",
]
}
llvm_library("LLVMX86Disassembler") {
deps = [
":LLVMMCDisassembler",
":LLVMSupport",
":LLVMX86Info",
]
}
llvm_library("LLVMX86Info") {
deps = [
":LLVMMC",
":LLVMSupport",
]
}