| # Copyright 2016 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. | |
| import("//build/config/clang/clang.gni") | |
| import("//build/config/clang/crash_diagnostics.gni") | |
| import("//build/config/clang/time_trace.gni") | |
| import("//build/config/compiler.gni") | |
| import("//build/config/linker.gni") | |
| import("//build/rust/config.gni") | |
| import("//build/toolchain/ccache.gni") | |
| import("//build/toolchain/concurrent_jobs.gni") | |
| import("//build/toolchain/goma.gni") | |
| declare_args() { | |
| if (is_fuchsia) { | |
| # Controls whether the compiler emits full stack frames for function calls. | |
| # This reduces performance but increases the ability to generate good | |
| # stack traces, especially when we have bugs around unwind table generation. | |
| # It applies only for Fuchsia targets (see below where it is unset). | |
| # | |
| # TODO(fxbug.dev/32216): Theoretically unwind tables should be good enough so we can | |
| # remove this option when the issues are addressed. | |
| enable_frame_pointers = is_debug | |
| } | |
| # **NOTE:** This is for **experimentation only** and should not normally be | |
| # changed. Set the version of the C++ standard to compile for, 17 or 20. | |
| experimental_cxx_version = 17 | |
| # Controls whether to use the ML inliner in Clang to reduce size. | |
| clang_ml_inliner = true | |
| } | |
| # No frame pointers for host compiles. | |
| if (!is_fuchsia) { | |
| enable_frame_pointers = false | |
| } | |
| if (zircon_toolchain != false) { | |
| import("//build/config/zircon/levels.gni") | |
| enable_frame_pointers = zx_assert_level > 0 | |
| } | |
| config("language") { | |
| cflags_c = [ "-std=c11" ] | |
| cflags_cc = [ "-std=c++$experimental_cxx_version" ] | |
| if (current_os == "mac") { | |
| # macOS needs this to not complain about C++17isms that older macOS | |
| # system libc++ doesn't support. But we use our own toolchain's static | |
| # libc++ anyway. | |
| cflags_cc += [ "-faligned-allocation" ] | |
| # libc++ headers mark some symbols as unavailable on macOS by default | |
| # because the system libc++ doesn't support them. But we use our own | |
| # toolchain's static libc++ anyway. | |
| defines = [ "_LIBCPP_DISABLE_AVAILABILITY" ] | |
| } | |
| } | |
| config("color_diagnostics") { | |
| # GCC correctly defaults this from the terminal, so leave it alone. | |
| if (!is_gcc) { | |
| cflags = [ "-fcolor-diagnostics" ] | |
| asmflags = cflags | |
| ldflags = cflags | |
| # The macOS linker does not support `--color-diagnostics`. | |
| if (current_os != "mac") { | |
| ldflags += [ "-Wl,--color-diagnostics" ] | |
| } | |
| } | |
| } | |
| config("crash-diagnostics-dir") { | |
| if (!is_gcc && crash_diagnostics_dir != "") { | |
| cflags = [ "-fcrash-diagnostics-dir=" + | |
| rebase_path(crash_diagnostics_dir, root_build_dir) ] | |
| asmflags = cflags | |
| ldflags = cflags | |
| } | |
| } | |
| config("time-trace") { | |
| if (!is_gcc && time_trace) { | |
| cflags = [ "-ftime-trace" ] | |
| asmflags = cflags | |
| ldflags = cflags | |
| } | |
| } | |
| config("compiler") { | |
| cflags = [] | |
| cflags_cc = [ "-fvisibility-inlines-hidden" ] | |
| cflags_objcc = [ "-fvisibility-inlines-hidden" ] | |
| configs = [ | |
| ":color_diagnostics", | |
| ":crash-diagnostics-dir", | |
| "rust:panic_cfg", | |
| ":time-trace", | |
| ":toolchain_version_stamp", | |
| ] | |
| if (!is_gcc) { | |
| # TODO(fxbug.dev/92521): Remove this after we address the wlan-hw-sim-test | |
| # failures with the new Clang ABI. | |
| cflags += [ "-fclang-abi-compat=13.0" ] | |
| configs += [ | |
| ":clang_defaults", | |
| ":ffp_contract", | |
| ] | |
| } | |
| if (current_os == "fuchsia") { | |
| configs += [ "//build/config/fuchsia:compiler" ] | |
| } else { | |
| if (current_os == "linux") { | |
| configs += [ "//build/config/linux:compiler" ] | |
| } else if (current_os == "mac") { | |
| configs += [ "//build/config/mac:compiler" ] | |
| } | |
| } | |
| asmflags = cflags | |
| } | |
| config("cpu_baseline") { | |
| if (current_cpu == "arm64") { | |
| configs = [ "//build/config/arm64" ] | |
| } else if (current_cpu == "x64") { | |
| configs = [ "//build/config/x64" ] | |
| } | |
| } | |
| # These flags are enabled by default in Fuchsia's Clang toolchain, but we set | |
| # them explicitly to support other Clang toolchains and Clang-based tools. | |
| config("clang_defaults") { | |
| if (clang_embed_bitcode) { | |
| cflags = [ | |
| "-Xclang", | |
| "-fembed-bitcode=all", | |
| ] | |
| } | |
| if (current_cpu == "x64") { | |
| asmflags = [ "-Wa,--mrelax-relocations=yes" ] | |
| } | |
| } | |
| config("ffp_contract") { | |
| # TODO(fxbug.dev/88681): This was the default for -ffp-model=precise until | |
| # LLVM revision f04e387055e495e3e14570087d68e93593cf2918 when Clang switched | |
| # to -ffp-contract=on. | |
| cflags = [ "-ffp-contract=off" ] | |
| asmflags = cflags | |
| } | |
| # We want to force a recompile and relink of the world whenever our toolchain | |
| # changes since artifacts from an older version of the toolchain may or may not | |
| # be compatible with newer ones. | |
| # | |
| # To achieve this, we insert an unused flag in the compile line. | |
| config("toolchain_version_stamp") { | |
| if (clang_prefix == default_clang_prefix) { | |
| clang_version = read_file( | |
| "//prebuilt/third_party/clang/${host_platform}/.versions/clang.cipd_version", | |
| "json") | |
| defines = [ "TOOLCHAIN_VERSION=${clang_version.instance_id}" ] | |
| } | |
| rustflags = [ "--cfg=__rust_toolchain=\"${rustc_version_string}\"" ] | |
| } | |
| config("relative_paths") { | |
| if (is_gcc) { | |
| if (use_goma) { | |
| # TODO(fxbug.dev/27308): `-fdebug-prefix-map` is also used by Goma to canonicalize | |
| # build commands, allowing it to reuse compilation results for users running | |
| # out of different working directories. However, it only supports a single | |
| # "-fdebug-prefix-map" prefix. Attempting to provide more than one causes | |
| # canonicalization to fail, meaning that builds running out of different | |
| # directories won't share cache results. For now, we just provide a single | |
| # debug-prefix-map, even though more would be ideal. | |
| # Map "/some/dir/fuchsia" to "../..". | |
| cflags = [ "-fdebug-prefix-map=" + rebase_path("//") + "=" + | |
| rebase_path("//", root_build_dir) ] | |
| } else { | |
| cflags = [ | |
| # Map "/some/dir/fuchsia/out/my-build.my-arch" to ".". | |
| "-fdebug-prefix-map=" + rebase_path(root_build_dir) + "=.", | |
| # Map "/some/dir/fuchsia/out" to "..". | |
| "-fdebug-prefix-map=" + rebase_path("$root_build_dir/..") + "=..", | |
| # Map "/some/dir/fuchsia" to "../..". | |
| "-fdebug-prefix-map=" + rebase_path("//") + "=" + | |
| rebase_path("//", root_build_dir), | |
| ] | |
| } | |
| } else { | |
| # Make builds independent of the absolute file path. -ffile-prefix-map= can | |
| # be used to the same effect, but it requires putting the absolute path to | |
| # the build directory in the compile command, thus making it dependent on | |
| # the absolute path of build directory. -ffile-compilation-dir is designed | |
| # to address this issue, making both debug info and coverage mapping | |
| # independent of the absolute path of the build directory. | |
| cflags = [ "-ffile-compilation-dir=." ] | |
| } | |
| if (!is_gcc) { | |
| # This makes sure that include directories in the toolchain are | |
| # represented as relative to the build directory (because that's how we | |
| # invoke the compiler), rather than absolute. This can affect __FILE__ | |
| # expansions (e.g. assertions in system headers). We normally run a | |
| # compiler that's someplace within the source tree, so its absolute | |
| # installation path will have a prefix matching `absolute_path` and | |
| # hence be mapped to `relative_path` in the debugging information, so | |
| # this should actually be superfluous for purposes of the debugging | |
| # information. | |
| cflags += [ "-no-canonical-prefixes" ] | |
| } | |
| asmflags = cflags | |
| ldflags = cflags | |
| if (current_os == "win") { | |
| ldflags += [ | |
| # This embeds just "name.pdb" in the binary instead of the absolute | |
| # path to the PDB file. | |
| "-Wl,/pdbaltpath:%_PDB%", | |
| # This embeds a fake Windows-style absolute path rather than the real | |
| # build-time absolute path in the PDB file. Windows apparently | |
| # requires an absolute path here, so we use an arbitrary fake one for | |
| # reproducibility. | |
| "-Wl,/pdbsourcepath:c:\\src", | |
| ] | |
| } | |
| # `-Zremap-cwd-prefix` ensures that absolute paths do not leak into | |
| # outputs for universal reproducibility while keeping the command line | |
| # free of absolute paths for remote caching benefit. | |
| # Available since: https://github.com/rust-lang/rust/pull/87320 | |
| rustflags = [ "-Zremap-cwd-prefix=." ] | |
| } | |
| config("debug") { | |
| rustflags = [ "-Cdebug-assertions=yes" ] | |
| } | |
| config("release") { | |
| defines = [ "NDEBUG=1" ] | |
| } | |
| config("exceptions") { | |
| cflags_cc = [ "-fexceptions" ] | |
| cflags_objcc = cflags_cc | |
| ldflags = cflags_cc | |
| } | |
| config("no_exceptions") { | |
| cflags_cc = [ "-fno-exceptions" ] | |
| cflags_objcc = cflags_cc | |
| ldflags = cflags_cc | |
| } | |
| config("rtti") { | |
| cflags_cc = [ "-frtti" ] | |
| cflags_objcc = cflags_cc | |
| ldflags = cflags_cc | |
| } | |
| config("no_rtti") { | |
| cflags_cc = [ "-fno-rtti" ] | |
| cflags_objcc = cflags_cc | |
| ldflags = cflags_cc | |
| } | |
| config("default_include_dirs") { | |
| include_dirs = [ | |
| "//", | |
| root_gen_dir, | |
| ] | |
| } | |
| config("linker_gc") { | |
| cflags = [ | |
| "-fdata-sections", | |
| "-ffunction-sections", | |
| ] | |
| ldflags = cflags | |
| if (current_os == "mac") { | |
| ldflags += [ "-Wl,-dead_strip" ] | |
| } else if (current_os == "win") { | |
| ldflags += [ "-Wl,/opt:ref" ] | |
| } else { | |
| ldflags += [ "-Wl,--gc-sections" ] | |
| } | |
| } | |
| config("default_linker_gc") { | |
| configs = [ ":linker_gc" ] | |
| } | |
| # Implicit dependencies for linker_gc config. | |
| group("linker_gc_deps") { | |
| } | |
| config("linker_string_merging") { | |
| if (current_os == "win") { | |
| ldflags = [ "-Wl,/opt:lldtailmerge" ] | |
| } else if (current_os != "mac") { | |
| ldflags = [ "-Wl,-O2" ] | |
| } | |
| } | |
| # Each optimize_$optimize config below corresponds to a single setting that's | |
| # controlled by the optimize argument. The default_optimize level is set to | |
| # optimize_$optimize for convenience, but individual targets can override their | |
| # optimization level by remove default_optimize and manually applying one of | |
| # the configs below. | |
| config("optimize_none") { | |
| cflags = [ "-O0" ] | |
| ldflags = cflags | |
| rustflags = [ "-Copt-level=0" ] | |
| } | |
| config("optimize_debug") { | |
| cflags = [ "-Og" ] | |
| ldflags = cflags | |
| # Rust doesn't recognize opt level "g", the closest is "1". | |
| # See: https://doc.rust-lang.org/rustc/codegen-options/index.html#opt-level | |
| rustflags = [ "-Copt-level=1" ] | |
| } | |
| config("optimize_default") { | |
| cflags = [ "-O2" ] | |
| ldflags = cflags | |
| rustflags = [ "-Copt-level=2" ] | |
| } | |
| config("optimize_size") { | |
| # GCC doesn't have -Oz | |
| if (!is_gcc && use_oz) { | |
| cflags = [ "-Oz" ] | |
| } else { | |
| # TODO(fxbug.dev/84386): We would ideally be using -Oz by default but that | |
| # currently frequently results in binaries that are larger than -Oz. | |
| cflags = [ "-Os" ] | |
| } | |
| ldflags = cflags | |
| if (clang_ml_inliner) { | |
| cflags += [ | |
| # `release` uses AOT model embedded inside the compiler. | |
| "-mllvm", | |
| "-enable-ml-inliner=release", | |
| ] | |
| } | |
| if (use_oz) { | |
| rustflags = [ "-Copt-level=z" ] | |
| } else { | |
| # TODO(fxbug.dev/84386): We would ideally be using -Oz by default but that | |
| # currently frequently results in binaries that are larger than -Oz. | |
| rustflags = [ "-Copt-level=s" ] | |
| } | |
| configs = [ ":linker_string_merging" ] | |
| } | |
| config("optimize_speed") { | |
| cflags = [ "-O3" ] | |
| ldflags = cflags | |
| rustflags = [ "-Copt-level=3" ] | |
| configs = [ ":linker_string_merging" ] | |
| } | |
| config("optimize_sanitizer") { | |
| # Instrumentation adds overhead that is greatly improved by optimization. | |
| # -O1 is well-tested with the instrumentation modes and does not degrade the | |
| # comprehensibility of backtraces produced by sanitizer failures. | |
| cflags = [ "-O1" ] | |
| ldflags = cflags | |
| rustflags = [ "-Copt-level=1" ] | |
| } | |
| config("optimize_profile") { | |
| if (zircon_toolchain != false) { | |
| # For Zircon artifacts, this must always enable optimizations | |
| # to ensure userboot.so is compiled with -O2 | |
| # See https://fxbug.dev/67467 for more context. | |
| configs = [ ":optimize_default" ] | |
| } else { | |
| cflags = [ "-O1" ] | |
| ldflags = cflags | |
| rustflags = [ "-Copt-level=1" ] | |
| } | |
| } | |
| config("optimize_coverage") { | |
| if (zircon_toolchain != false) { | |
| # For Zircon artifacts, this must always enable optimizations | |
| # to ensure userboot.so is compiled with -O2 | |
| # See https://fxbug.dev/67467 for more context. | |
| configs = [ ":optimize_default" ] | |
| } else { | |
| cflags = [ "-O1" ] | |
| ldflags = cflags | |
| rustflags = [ "-Copt-level=1" ] | |
| } | |
| } | |
| config("default_optimize") { | |
| configs = [ ":optimize_${optimize}" ] | |
| } | |
| # Each of the debuginfo_$debuginfo configs below corresponds to a single setting | |
| # that controls the amount of debugging information used and is controlled by | |
| # the debuginfo argument. The default_debuginfo level is set to | |
| # debuginfo_$debuginfo for convenience, but individual targets can override | |
| # their debuginfo level by manually applying one of the configs below. | |
| config("debuginfo_none") { | |
| cflags = [ "-g0" ] | |
| if (current_os != "win") { | |
| asmflags = cflags | |
| } | |
| ldflags = cflags | |
| rustflags = [ "-Cdebuginfo=0" ] | |
| } | |
| config("debuginfo_backtrace") { | |
| cflags = [ "-g1" ] | |
| if (current_os != "win") { | |
| asmflags = cflags | |
| } | |
| ldflags = cflags | |
| rustflags = [ "-Cdebuginfo=1" ] | |
| } | |
| config("debuginfo_debug") { | |
| cflags = [ "-g3" ] | |
| if (current_os != "win") { | |
| asmflags = cflags | |
| } | |
| ldflags = cflags | |
| rustflags = [ "-Cdebuginfo=2" ] | |
| } | |
| config("default_debuginfo") { | |
| configs = [ ":debuginfo_${debuginfo}" ] | |
| if (current_os != "win") { | |
| cflags = [ "-gdwarf-${dwarf_version}" ] | |
| if (!is_gcc) { | |
| # This option forces Clang to only emit class type information when | |
| # constructors are emitted which can significantly reduce debug info | |
| # size. Eventually, this option will enabled by default in Clang when | |
| # -fno-standalone-debug is used. | |
| cflags += [ | |
| "-Xclang", | |
| "-debug-info-kind=constructor", | |
| ] | |
| } | |
| asmflags = cflags | |
| } else if (debuginfo != "none" && current_os == "win") { | |
| # TODO(fxbug.dev/55244): This produces the .pdb file, but it doesn't seem | |
| # to get the DWARF data out of the main output file. | |
| ldflags = [ "-Wl,/debug:full" ] | |
| } | |
| } | |
| config("default_frame_pointers") { | |
| if (enable_frame_pointers) { | |
| configs = [ ":frame_pointers" ] | |
| } else { | |
| configs = [ ":no_frame_pointers" ] | |
| } | |
| } | |
| config("frame_pointers") { | |
| cflags = [ "-fno-omit-frame-pointer" ] | |
| ldflags = cflags | |
| rustflags = [ "-Cforce-frame-pointers" ] | |
| if (zircon_toolchain != false) { | |
| defines = [ "WITH_FRAME_POINTERS=1" ] | |
| } | |
| } | |
| group("frame_pointers_deps") { | |
| # Implicit dependencies for frame_pointers config | |
| } | |
| config("no_frame_pointers") { | |
| cflags = [ "-fomit-frame-pointer" ] | |
| ldflags = cflags | |
| # rustc automatically does this for release builds, and there's no way to | |
| # force it for non-release. | |
| if (zircon_toolchain != false) { | |
| defines = [ "WITH_FRAME_POINTERS=0" ] | |
| } | |
| } | |
| group("no_frame_pointers_deps") { | |
| # Implicit dependencies for no_frame_pointers config | |
| } | |
| config("suppress_iterator_warnings") { | |
| defines = [ "_LIBCPP_DISABLE_DEPRECATION_WARNINGS" ] | |
| visibility = [ | |
| "//third_party/flatbuffers/*", | |
| "//third_party/grpc/*", | |
| ] | |
| } | |
| config("default_warnings") { | |
| cflags = [ | |
| "-Wall", | |
| "-Wextra", | |
| "-Wconversion", | |
| "-Wextra-semi", | |
| "-Wimplicit-fallthrough", | |
| "-Wnewline-eof", | |
| "-Wstrict-prototypes", | |
| "-Wwrite-strings", | |
| "-Wno-sign-conversion", | |
| "-Wno-unused-parameter", | |
| "-Wnonportable-system-include-path", | |
| ] | |
| if (is_gcc) { | |
| # GCC is pedantic about which flags apply to which language. | |
| cflags -= [ | |
| "-Wstrict-prototypes", | |
| "-Wextra-semi", | |
| ] | |
| cflags_c = [ "-Wstrict-prototypes" ] | |
| cflags_cc = [ "-Wextra-semi" ] | |
| # GCC doesn't support these flags | |
| cflags -= [ | |
| "-Wnewline-eof", | |
| "-Wnonportable-system-include-path", | |
| ] | |
| cflags += [ | |
| # TODO(fxbug.dev/64272): Disable "-Wmissing-field-initializers" which | |
| # warns when designated initializers are used on some (but not all) | |
| # fields in C++, contrary to its documentation (and Clang). | |
| # | |
| # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39589. | |
| "-Wno-missing-field-initializers", | |
| # TODO(fxbug.dev/101358): -Warray-bounds has false positives in GCC 12. | |
| # When https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105762 is fixed, | |
| # remove this. | |
| "-Wno-array-bounds", | |
| ] | |
| } | |
| } | |
| # TODO(fxbug.dev/58161): clean up instances of this outside of third party code. | |
| config("Wno-unused-function") { | |
| cflags = [ "-Wno-unused-function" ] | |
| visibility = [ | |
| "//src/devices/i2c/drivers/aml-i2c:aml-i2c-driver", | |
| "//src/devices/i2c/drivers/intel-i2c:intel-i2c-driver", | |
| "//zircon/third_party/uapp/dash", | |
| "//zircon/third_party/ulib/musl/ldso", | |
| "//zircon/third_party/ulib/musl/src/network", | |
| "//zircon/third_party/ulib/musl/src/time", | |
| ] | |
| } | |
| config("Wno-range-loop-construct") { | |
| cflags = [ "-Wno-range-loop-construct" ] | |
| visibility = [ "//src/developer/debug/third_party/libunwindstack" ] | |
| } | |
| config("Wno-strict-prototypes") { | |
| cflags = [ "-Wno-strict-prototypes" ] | |
| } | |
| # TODO(fxbug.dev/58162): clean up instances of this outside of third party code. | |
| # | |
| # NOTE: Do not add this to public_configs under any circumstances. Public | |
| # configs are viral and will infect unsuspecting targets. | |
| config("Wno-conversion") { | |
| cflags = [ "-Wno-conversion" ] | |
| # To trim this list: | |
| # $ scripts/gn/trim_visibility.py --target="//build/config:Wno-conversion" | |
| visibility = [ | |
| "//sdk/lib/media/audio/cpp:*", | |
| "//sdk/lib/media/cpp:*", | |
| "//sdk/lib/sys/cpp/tests:*", | |
| "//sdk/lib/sys/service/cpp:*", | |
| "//sdk/lib/syslog/streams/cpp:*", | |
| "//sdk/lib/vfs/cpp:*", | |
| "//sdk/lib/vfs/cpp/testing:*", | |
| "//src/bringup/bin/ptysvc:*", | |
| "//src/camera/bin/camera-gym:*", | |
| "//src/camera/drivers/controller/test:*", | |
| "//src/camera/drivers/hw_accel/gdc:*", | |
| "//src/camera/drivers/hw_accel/ge2d:*", | |
| "//src/camera/drivers/sensors/imx227:*", | |
| "//src/camera/lib/image_utils:*", | |
| "//src/camera/lib/virtual_camera:*", | |
| "//src/cobalt/bin/system-metrics:*", | |
| "//src/cobalt/bin/testapp:*", | |
| "//src/connectivity/bluetooth/core/bt-host/gap:*", | |
| "//src/connectivity/bluetooth/core/bt-host/gatt:*", | |
| "//src/connectivity/bluetooth/core/bt-host/hci:*", | |
| "//src/connectivity/bluetooth/core/bt-host/l2cap:*", | |
| "//src/connectivity/bluetooth/core/bt-host/sdp:*", | |
| "//src/connectivity/bluetooth/core/bt-host/sm:*", | |
| "//src/connectivity/bluetooth/core/bt-host/socket:*", | |
| "//src/connectivity/bluetooth/core/bt-host/testing:*", | |
| "//src/connectivity/bluetooth/core/bt-host/transport:*", | |
| "//src/connectivity/bluetooth/hci/emulator:*", | |
| "//src/connectivity/bluetooth/hci/transport/uart:*", | |
| "//src/connectivity/bluetooth/hci/vendor/broadcom:*", | |
| "//src/connectivity/bluetooth/hci/vendor/intel:*", | |
| "//src/connectivity/bluetooth/tools/bt-hci-tool:*", | |
| "//src/connectivity/bluetooth/tools/bt-intel-tool:*", | |
| "//src/connectivity/network/tools/nc/third_party/openbsd-netcat:*", | |
| "//src/connectivity/openthread/drivers/ot-radio:*", | |
| "//src/connectivity/openthread/tests/fake-drivers/fake-ot-radio:*", | |
| "//src/connectivity/telephony/drivers/qmi-fake-transport:*", | |
| "//src/connectivity/telephony/drivers/qmi-usb-transport:*", | |
| "//src/connectivity/telephony/tests/driver-unit:*", | |
| "//src/connectivity/telephony/tests/fake-drivers/at-fake-transport:*", | |
| "//src/connectivity/telephony/tests/fake-drivers/usb-qmi-function:*", | |
| "//src/connectivity/wlan/drivers/testing:*", | |
| "//src/connectivity/wlan/drivers/testing/lib/sim-env:*", | |
| "//src/connectivity/wlan/drivers/testing/lib/sim-env/test:*", | |
| "//src/connectivity/wlan/drivers/testing/lib/sim-fake-ap:*", | |
| "//src/connectivity/wlan/drivers/testing/lib/sim-fake-ap/test:*", | |
| "//src/connectivity/wlan/drivers/third_party/atheros/ath10k:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/chipset:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/msgbuf:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/msgbuf/test:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/pcie:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sdio:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sdio/test:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test:*", | |
| "//src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/test:*", | |
| "//src/connectivity/wlan/drivers/third_party/intel/iwlwifi:*", | |
| "//src/connectivity/wlan/drivers/third_party/intel/iwlwifi/mvm:*", | |
| "//src/connectivity/wlan/drivers/third_party/intel/iwlwifi/pcie:*", | |
| "//src/connectivity/wlan/drivers/third_party/intel/iwlwifi/platform:*", | |
| "//src/connectivity/wlan/drivers/wlan:*", | |
| "//src/connectivity/wlan/drivers/wlanif:*", | |
| "//src/connectivity/wlan/drivers/wlanif/test:*", | |
| "//src/connectivity/wlan/drivers/wlanphy:*", | |
| "//src/connectivity/wlan/lib/common/cpp:*", | |
| "//src/connectivity/wlan/lib/mlme/cpp:*", | |
| "//src/connectivity/wlan/lib/mlme/cpp/tests:*", | |
| "//src/connectivity/wlan/testing/wlantap-driver:*", | |
| "//src/developer/debug/debug_agent:*", | |
| "//src/developer/debug/debug_agent/integration_tests:*", | |
| "//src/developer/debug/third_party/libunwindstack:*", | |
| "//src/developer/debug/zxdb/client:*", | |
| "//src/developer/debug/zxdb/console:*", | |
| "//src/developer/debug/zxdb/debug_adapter:*", | |
| "//src/developer/debug/zxdb/expr:*", | |
| "//src/developer/debug/zxdb/symbols:*", | |
| "//src/developer/ffx/lib/buildid/cpp:*", | |
| "//src/developer/forensics/exceptions/tests:*", | |
| "//src/developer/forensics/feedback_data/tests:*", | |
| "//src/developer/memory/metrics:*", | |
| "//src/developer/memory/monitor/tests:*", | |
| "//src/developer/shell/josh/console:*", | |
| "//src/developer/shell/josh/lib:*", | |
| "//src/developer/tracing/lib/trace_converters:*", | |
| "//src/devices/bin/driver_host:*", | |
| "//src/devices/bin/driver_manager:*", | |
| "//src/devices/block/bin/gpt:*", | |
| "//src/devices/block/drivers/ftl:*", | |
| "//src/devices/block/drivers/ftl/tests:*", | |
| "//src/devices/block/drivers/nvme:*", | |
| "//src/devices/board/drivers/x86:*", | |
| "//src/devices/bus/drivers/pci:*", | |
| "//src/devices/bus/drivers/pci/test:*", | |
| "//src/devices/bus/drivers/platform/test:*", | |
| "//src/devices/bus/lib/virtio:*", | |
| "//src/devices/cpu/drivers/aml-cpu-legacy:*", | |
| "//src/devices/i2c/drivers/intel-i2c:*", | |
| "//src/devices/internal/drivers/fragment:*", | |
| "//src/devices/lib/amlogic:*", | |
| "//src/devices/lib/fidl-metadata/test:*", | |
| "//src/devices/lib/goldfish/pipe_io:*", | |
| "//src/devices/nand/drivers/intel-spi-flash:*", | |
| "//src/devices/nand/drivers/ram-nand:*", | |
| "//src/devices/pci/testing:*", | |
| "//src/devices/power/drivers/fusb302:*", | |
| "//src/devices/power/drivers/ti-ina231:*", | |
| "//src/devices/pwm/drivers/aml-pwm:*", | |
| "//src/devices/radar/tests/radar-integration-test:*", | |
| "//src/devices/rtc/drivers/intel-rtc:*", | |
| "//src/devices/spi/drivers/aml-spi:*", | |
| "//src/devices/spi/drivers/intel-gspi:*", | |
| "//src/devices/spi/drivers/spi:*", | |
| "//src/devices/sysmem/drivers/sysmem:*", | |
| "//src/devices/tee/drivers/optee:*", | |
| "//src/devices/temperature/drivers/shtv3:*", | |
| "//src/devices/testing/fake-msi:*", | |
| "//src/devices/testing/goldfish/fake_pipe:*", | |
| "//src/devices/tpm/drivers/cr50-spi:*", | |
| "//src/devices/tpm/drivers/tpm:*", | |
| "//src/devices/usb/drivers/xhci:*", | |
| "//src/diagnostics/validator/inspect/lib/cpp:*", | |
| "//src/firmware/gigaboot/lib", | |
| "//src/firmware/gigaboot/src", | |
| "//src/graphics/display/drivers/aml-hdmi:*", | |
| "//src/graphics/display/drivers/amlogic-display:*", | |
| "//src/graphics/display/drivers/display:*", | |
| "//src/graphics/display/drivers/fake:*", | |
| "//src/graphics/display/drivers/goldfish-display:*", | |
| "//src/graphics/display/drivers/intel-i915:*", | |
| "//src/graphics/display/drivers/ssd1306:*", | |
| "//src/graphics/display/lib/designware:*", | |
| "//src/graphics/display/lib/designware/test:*", | |
| "//src/graphics/display/testing:*", | |
| "//src/graphics/drivers/misc/goldfish:*", | |
| "//src/graphics/drivers/misc/goldfish_address_space:*", | |
| "//src/graphics/drivers/misc/goldfish_sync:*", | |
| "//src/graphics/drivers/msd-arm-mali/src:*", | |
| "//src/graphics/lib/compute/svg:*", | |
| "//src/lib/backoff:*", | |
| "//src/lib/chunked-compression:*", | |
| "//src/lib/cobalt/cpp:*", | |
| "//src/lib/containers/cpp:*", | |
| "//src/lib/ddk:*", | |
| "//src/lib/debugger_utils:*", | |
| "//src/lib/elflib:*", | |
| "//src/lib/fidl/cpp/tests/dispatcher:*", | |
| "//src/lib/fidl/llcpp/tests:*", | |
| "//src/lib/fidl/llcpp/tests/conformance:*", | |
| "//src/lib/fidl/llcpp/tests/integration:*", | |
| "//src/lib/fidl/llcpp/tests/wire_types:*", | |
| "//src/lib/files:*", | |
| "//src/lib/fsl/socket:*", | |
| "//src/lib/fsl/vmo:*", | |
| "//src/lib/icu/tools/extractor:*", | |
| "//src/lib/intel_pt_decode/*", | |
| "//src/lib/json_parser:*", | |
| "//src/lib/line_input:*", | |
| "//src/lib/listnode:*", | |
| "//src/lib/process_builder:*", | |
| "//src/lib/storage/vfs/cpp:*", | |
| "//src/lib/ui/input:*", | |
| "//src/lib/ui/scenic/cpp:*", | |
| "//src/lib/usb_bulk/cpp:*", | |
| "//src/lib/vmo_store:*", | |
| "//src/lib/vulkan/imagepipe_view:*", | |
| "//src/lib/vulkan/tests:*", | |
| "//src/media/audio/audio_core:*", | |
| "//src/media/audio/drivers/aml-g12-tdm/test:*", | |
| "//src/media/audio/drivers/codecs/tas27xx:*", | |
| "//src/media/audio/drivers/codecs/tas5720:*", | |
| "//src/media/audio/drivers/intel-hda/controller:*", | |
| "//src/media/audio/drivers/lib/audio-utils:*", | |
| "//src/media/audio/drivers/lib/intel-hda:*", | |
| "//src/media/drivers/amlogic_decoder/third_party/libvpx:*", | |
| "//src/media/drivers/amlogic_decoder/third_party/vp9_adapt_probs:*", | |
| "//src/media/lib/codec_impl/unit_tests:*", | |
| "//src/media/lib/extend_bits/unit_tests:*", | |
| "//src/media/playback/mediaplayer:*", | |
| "//src/media/playback/mediaplayer/demux:*", | |
| "//src/media/playback/mediaplayer/ffmpeg:*", | |
| "//src/media/playback/mediaplayer/fidl:*", | |
| "//src/media/playback/mediaplayer/graph:*", | |
| "//src/media/playback/mediaplayer/metrics:*", | |
| "//src/media/sounds/soundplayer:*", | |
| "//src/media/vnext/lib/ffmpeg/*", | |
| "//src/modular/bin/sessionctl:*", | |
| "//src/modular/bin/sessionmgr:*", | |
| "//src/modular/bin/sessionmgr/puppet_master:*", | |
| "//src/modular/bin/sessionmgr/storage:*", | |
| "//src/modular/lib/async/cpp:*", | |
| "//src/modular/lib/modular_config:*", | |
| "//src/modular/lib/modular_test_harness/cpp:*", | |
| "//src/modular/tests:*", | |
| "//src/performance/lib/perfmon:*", | |
| "//src/performance/lib/profiler:*", | |
| "//src/performance/lib/profiler/tests:*", | |
| "//src/security/tee_manager:*", | |
| "//src/sys/appmgr:*", | |
| "//src/sys/appmgr/integration_tests/mock_runner:*", | |
| "//src/sys/appmgr/integration_tests/sandbox/features/storage:*", | |
| "//src/sys/appmgr/integration_tests/util:*", | |
| "//src/sys/lib/chrealm:*", | |
| "//src/sys/pkg/lib/far/cpp:*", | |
| "//src/sys/sysmgr:*", | |
| "//src/ui/a11y/bin/a11y_manager/tests:*", | |
| "//src/ui/a11y/bin/a11y_manager/tests/util:*", | |
| "//src/ui/a11y/lib/annotation:*", | |
| "//src/ui/a11y/lib/configuration:*", | |
| "//src/ui/a11y/lib/configuration/tests:*", | |
| "//src/ui/a11y/lib/gesture_manager/recognizers/tests:*", | |
| "//src/ui/a11y/lib/magnifier/tests:*", | |
| "//src/ui/a11y/lib/screen_reader:*", | |
| "//src/ui/a11y/lib/screen_reader/focus/tests/mocks:*", | |
| "//src/ui/a11y/lib/screen_reader/i18n:*", | |
| "//src/ui/a11y/lib/screen_reader/i18n/tests:*", | |
| "//src/ui/a11y/lib/screen_reader/tests:*", | |
| "//src/ui/a11y/lib/semantics:*", | |
| "//src/ui/a11y/lib/semantics/tests:*", | |
| "//src/ui/a11y/lib/semantics/tests/mocks:*", | |
| "//src/ui/a11y/lib/semantics/util/tests:*", | |
| "//src/ui/a11y/lib/util:*", | |
| "//src/ui/backlight/drivers/ti-lp8556:*", | |
| "//src/ui/bin/root_presenter:*", | |
| "//src/ui/bin/root_presenter/tests:*", | |
| "//src/ui/examples/escher/common:*", | |
| "//src/ui/input/drivers/goodix:*", | |
| "//src/ui/input/drivers/hid-buttons:*", | |
| "//src/ui/input/drivers/pc-ps2:*", | |
| "//src/ui/input/lib/hid-input-report:*", | |
| "//src/ui/lib/escher/test:*", | |
| "//src/ui/lib/escher/test/common:*", | |
| "//src/ui/lib/yuv:*", | |
| "//src/ui/scenic/bin:*", | |
| "//src/ui/scenic/lib/display:*", | |
| "//src/ui/scenic/lib/flatland:*", | |
| "//src/ui/scenic/lib/flatland/buffers:*", | |
| "//src/ui/scenic/lib/flatland/engine:*", | |
| "//src/ui/scenic/lib/flatland/renderer:*", | |
| "//src/ui/scenic/lib/flatland/renderer/tests:*", | |
| "//src/ui/scenic/lib/flatland/tests:*", | |
| "//src/ui/scenic/lib/gfx:*", | |
| "//src/ui/scenic/lib/gfx/tests:*", | |
| "//src/ui/scenic/lib/input:*", | |
| "//src/ui/scenic/lib/input/tests:*", | |
| "//src/ui/scenic/lib/scheduling/tests:*", | |
| "//src/ui/tools/tiles_ctl:*", | |
| "//src/virtualization/third_party/fdt:*", | |
| "//third_party/acpica/*", | |
| "//third_party/crashpad/*", | |
| "//third_party/glfw/*", | |
| "//third_party/iperf/*", | |
| "//third_party/libc-tests/*", | |
| "//third_party/mesa/*", | |
| "//third_party/micro-ecc/*", | |
| "//third_party/modp_b64:*", | |
| "//third_party/ogg/*", | |
| "//third_party/opus/*", | |
| "//third_party/rust_crates/compat/brotli:*", | |
| "//third_party/zstd:*", | |
| "//tools/bootserver_old:*", | |
| "//tools/fidlcat:*", | |
| "//tools/fidlcat/interception_tests:*", | |
| "//tools/fidlcat/lib:*", | |
| "//tools/netprotocol:*", | |
| "//tools/symbolizer:*", | |
| "//tools/vboot_reference:*", | |
| "//vendor/*", | |
| "//zircon/system/ulib/hid:*", | |
| "//zircon/system/ulib/image-format:*", | |
| "//zircon/system/ulib/ktrace:*", | |
| "//zircon/system/ulib/ldmsg:*", | |
| "//zircon/system/ulib/spi:*", | |
| "//zircon/system/ulib/sysconfig-client:*", | |
| "//zircon/system/ulib/sysmem-version:*", | |
| "//zircon/system/ulib/sysmem-version/test:*", | |
| "//zircon/system/ulib/tftp:*", | |
| "//zircon/system/ulib/trace:*", | |
| "//zircon/system/ulib/trace-engine:*", | |
| "//zircon/system/utest/msd:*", | |
| "//zircon/third_party/dev/ethernet/e1000:*", | |
| "//zircon/third_party/lib/jitterentropy", | |
| "//zircon/third_party/uapp/dash:*", | |
| "//zircon/third_party/uapp/fsck-msdosfs:*", | |
| "//zircon/third_party/uapp/mkfs-msdosfs:*", | |
| "//zircon/third_party/ulib/cksum:*", | |
| "//zircon/third_party/ulib/linenoise:*", | |
| "//zircon/third_party/ulib/musl:*", | |
| "//zircon/third_party/ulib/musl/ldso", | |
| "//zircon/third_party/ulib/musl/src/complex", | |
| "//zircon/third_party/ulib/musl/src/dirent", | |
| "//zircon/third_party/ulib/musl/src/env", | |
| "//zircon/third_party/ulib/musl/src/fenv", | |
| "//zircon/third_party/ulib/musl/src/internal", | |
| "//zircon/third_party/ulib/musl/src/ipc", | |
| "//zircon/third_party/ulib/musl/src/legacy", | |
| "//zircon/third_party/ulib/musl/src/locale", | |
| "//zircon/third_party/ulib/musl/src/math", | |
| "//zircon/third_party/ulib/musl/src/multibyte", | |
| "//zircon/third_party/ulib/musl/src/network", | |
| "//zircon/third_party/ulib/musl/src/passwd", | |
| "//zircon/third_party/ulib/musl/src/prng", | |
| "//zircon/third_party/ulib/musl/src/process", | |
| "//zircon/third_party/ulib/musl/src/regex", | |
| "//zircon/third_party/ulib/musl/src/sched", | |
| "//zircon/third_party/ulib/musl/src/stdio", | |
| "//zircon/third_party/ulib/musl/src/stdlib", | |
| "//zircon/third_party/ulib/musl/src/string:*", | |
| "//zircon/third_party/ulib/musl/src/time", | |
| "//zircon/third_party/ulib/musl/src/unistd", | |
| "//zircon/third_party/ulib/musl/third_party/complex", | |
| "//zircon/third_party/ulib/musl/third_party/math", | |
| "//zircon/third_party/ulib/musl/third_party/tre", | |
| "//zircon/third_party/ulib/ngunwind:*", | |
| "//zircon/tools/blobfs:*", | |
| "//zircon/tools/lz4:*", | |
| ] | |
| } | |
| config("Wno-extra-semi") { | |
| cflags = [ "-Wno-extra-semi" ] | |
| } | |
| config("Wno-implicit-fallthrough") { | |
| cflags = [ "-Wno-implicit-fallthrough" ] | |
| visibility = [ | |
| "//src/lib/fxl:third_party", | |
| "//third_party/rust_crates/compat/brotli", | |
| "//zircon/third_party/uapp/dash", | |
| "//zircon/third_party/ulib/boringssl", | |
| "//zircon/third_party/ulib/lz4", | |
| "//zircon/tools/lz4", | |
| ] | |
| } | |
| # Config to suppress Wno-unused-but-set-parameter warning in the third party code | |
| # that doesn't comply with. | |
| config("Wno-unused-but-set-parameter") { | |
| cflags = [ "-Wno-unused-but-set-parameter" ] | |
| visibility = [ | |
| "//third_party/*", | |
| "//vendor/*", | |
| "//zircon/third_party/uapp/dash", | |
| ] | |
| } | |
| # Config to suppress Wunused-but-set-variable warning in the third party code | |
| # that doesn't comply with. | |
| config("Wno-unused-but-set-variable") { | |
| cflags = [ "-Wno-unused-but-set-variable" ] | |
| visibility = [ | |
| "//src/connectivity/network/tools/nc/third_party/openbsd-netcat/*", | |
| "//src/connectivity/wlan/drivers/third_party/*", | |
| "//src/devices/power/drivers/fusb302/*", | |
| "//src/devices/usb/drivers/xhci/*", | |
| "//src/media/audio/drivers/usb-audio/*", | |
| "//src/performance/insntrace/*", | |
| "//src/storage/fvm/driver/*", | |
| "//third_party/*", | |
| "//vendor/*", | |
| "//zircon/third_party/uapp/dash", | |
| ] | |
| } | |
| # Config to suppress Wbitwise-instead-of-logical warning in the third party code | |
| # that doesn't comply with. | |
| config("Wno-bitwise-instead-of-logical") { | |
| cflags = [ "-Wno-bitwise-instead-of-logical" ] | |
| visibility = [ "//third_party/zstd:*" ] | |
| } | |
| config("Wno-defaulted-function-deleted") { | |
| cflags = [ "-Wno-defaulted-function-deleted" ] | |
| visibility = [ "//src/lib/vulkan/*" ] | |
| } | |
| config("symbol_visibility_hidden") { | |
| # Disable libc++ visibility annotations to make sure that the compiler option | |
| # has effect on symbols defined in libc++ headers. Note that we don't want to | |
| # disable these annotations altogether to ensure that our toolchain is usable | |
| # outside of our build since not every user uses hidden visibility by default. | |
| defines = [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ] | |
| cflags = [ "-fvisibility=hidden" ] | |
| if (zircon_toolchain != false) { | |
| cflags_cc = [ "-fvisibility-inlines-hidden" ] | |
| } | |
| } | |
| config("symbol_no_undefined") { | |
| if (current_os == "mac") { | |
| ldflags = [ "-Wl,-undefined,error" ] | |
| } else { | |
| ldflags = [ "-Wl,--no-undefined" ] | |
| } | |
| } | |
| config("shared_library_config") { | |
| if (current_os == "fuchsia") { | |
| configs = [ "//build/config/fuchsia:shared_library_config" ] | |
| } else if (current_os == "linux") { | |
| cflags = [ "-fPIC" ] | |
| } else if (current_os == "mac") { | |
| configs = [ "//build/config/mac:mac_dynamic_flags" ] | |
| } | |
| } | |
| config("executable_config") { | |
| configs = [] | |
| if (current_os == "fuchsia") { | |
| configs += [ "//build/config/fuchsia:executable_config" ] | |
| } else if (current_os == "mac") { | |
| configs += [ | |
| "//build/config/mac:mac_dynamic_flags", | |
| "//build/config/mac:mac_executable_flags", | |
| ] | |
| } | |
| } | |
| config("default_libs") { | |
| configs = [] | |
| if (current_os == "mac") { | |
| configs += [ "//build/config/mac:default_libs" ] | |
| } | |
| } | |
| config("werror") { | |
| if (!use_ccache) { | |
| cflags = [ | |
| "-Werror", | |
| # Declarations marked as deprecated should cause build failures, rather | |
| # they should emit warnings to notify developers about the use of | |
| # deprecated interfaces. | |
| "-Wno-error=deprecated-declarations", | |
| # Do not add additional -Wno-error to this config. | |
| ] | |
| asmflags = [ "-Wa,--fatal-warnings" ] | |
| cflags += asmflags | |
| if (current_os == "win") { | |
| ldflags = [ "-Wl,/WX" ] | |
| } | |
| } | |
| rustflags = [ "-Dwarnings" ] | |
| } | |
| # Please use //build/config/sanitizers:suppress-ubsan.DO-NOT-USE-THIS instead | |
| config("temporarily_disable_ubsan_do_not_use") { | |
| configs = [ "//build/config/sanitizers:suppress-ubsan.DO-NOT-USE-THIS" ] | |
| visibility = [ "//third_party/*" ] | |
| } | |
| config("no_stack_protector") { | |
| cflags = [ "-fno-stack-protector" ] | |
| } | |
| config("no_profile") { | |
| # The difference between this config and removing //build/config/profile is | |
| # the dynamic linker setting which is necessary for it to use at runtime with | |
| # the libraries it was linked against. | |
| cflags = [ | |
| "-fno-profile-instr-generate", | |
| "-fno-coverage-mapping", | |
| ] | |
| } | |
| config("icf") { | |
| # This changes C/C++ semantics and might be incompatible with third-party | |
| # code that relies on function pointers comparison. | |
| if (current_os == "win" && (linker == "lld" || !is_gcc)) { | |
| ldflags = [ "-Wl,/opt:icf=all" ] | |
| } else if (linker == "gold" || linker == "lld") { | |
| ldflags = [ "-Wl,--icf=all" ] | |
| } | |
| } | |
| # "_ALL_SOURCE" is used by some system headers to expose more features (say in fcntl.h) beyond those | |
| # strictly defined in standard. | |
| config("all_source") { | |
| defines = [ "_ALL_SOURCE" ] | |
| } | |
| config("auto_var_init") { | |
| if (!is_gcc) { | |
| # Automatically initialize variables with a pattern. | |
| cflags = [ "-ftrivial-auto-var-init=pattern" ] | |
| } | |
| } | |
| config("thread_safety_annotations") { | |
| if (!is_gcc) { | |
| cflags = [ "-Wthread-safety" ] | |
| defines = [ "_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1" ] | |
| } | |
| } | |
| # Tools that must be executed locally. | |
| pool("local") { | |
| depth = default_concurrent_jobs.local | |
| } |