| # Copyright 2025 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" |
| } |
| |
| 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 = [ |
| "//src/lib/llvm: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", |
| ] |
| } |
| } |