| # 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") |
| import("//build/unification/global_variables.gni") |
| import("//zircon/public/gn/config/experimental_cxx_version.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 |
| } |
| |
| # Controls whether the rust compiler uses v0 symbol mangling scheme |
| # (see https://github.com/rust-lang/rfcs/blob/HEAD/text/2603-rust-symbol-name-mangling-v0.md). |
| # The v0 symbol mangling scheme requires upstream LLVM support when demangling, |
| # so it is not on by default. |
| # TODO(fxbug.dev/57302): Enable v0 mangling by default. |
| rust_v0_symbol_mangling = false |
| } |
| |
| # No frame pointers for host compiles. |
| if (!is_fuchsia) { |
| enable_frame_pointers = false |
| } |
| |
| # Turns on the rust compilation analysis generator. This will produce a |
| # directory $OUT/save-analysis-temp, which will dump all the source analysis |
| # that the compiler collected while analyzing the source. This config is |
| # included conditionally, see //build/config/BUILDCONFIG.gn for details. |
| config("rust_analysis") { |
| rustflags = [ "-Zsave-analysis" ] |
| } |
| |
| config("rust_edition_2018") { |
| rustflags = [ "--edition=2018" ] |
| } |
| |
| config("rust_edition_2015") { |
| rustflags = [ "--edition=2015" ] |
| } |
| |
| config("rust_opt_level_z") { |
| rustflags = [ "-Copt-level=z" ] |
| } |
| |
| config("rust_no_features") { |
| rustflags = [ "-Zallow-features=" ] |
| } |
| |
| config("netstack3_only_specialization_feature") { |
| rustflags = [ |
| "-Zallow-features=specialization", |
| "-Aincomplete-features", |
| ] |
| } |
| |
| config("rust_2018_idioms") { |
| rustflags = [ "-Wrust-2018-idioms" ] |
| } |
| |
| config("rust_target") { |
| rustflags = [ |
| "--target", |
| rust_target, |
| "--cap-lints=$rust_cap_lints", |
| ] |
| } |
| |
| config("rust_panic_abort") { |
| rustflags = [ |
| "-Cpanic=abort", |
| "-Cforce-unwind-tables=yes", |
| "-Zpanic_abort_tests", |
| ] |
| } |
| |
| config("rust_v0_symbol_mangling") { |
| if (rust_v0_symbol_mangling) { |
| rustflags = [ "-Zsymbol-mangling-version=v0" ] |
| } |
| } |
| |
| # TODO(fxbug.dev/67118) remove this allowance |
| config("rust_allow_redundant_semicolons") { |
| rustflags = [ "-Aredundant-semicolons" ] |
| } |
| |
| 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) { |
| configs += [ ":clang_defaults" ] |
| } |
| |
| 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 |
| } |
| |
| # 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") { |
| cflags = [ "-fexperimental-new-pass-manager" ] |
| asmflags = cflags |
| ldflags = cflags |
| if (clang_embed_bitcode) { |
| cflags += [ |
| "-Xclang", |
| "-fembed-bitcode=all", |
| ] |
| } |
| if (current_cpu == "x64") { |
| asmflags += [ "-Wa,--mrelax-relocations=yes" ] |
| } |
| } |
| |
| # 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") { |
| # TODO(fxbug.dev/54161): Keep in sync with //zircon/public/gn/config:relative_paths |
| # until build unification completes. |
| |
| 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("$zx/..") + "=" + |
| rebase_path("$zx/..", 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("$zx/..") + "=" + |
| rebase_path("$zx/..", root_build_dir), |
| ] |
| } |
| } else { |
| # Make builds independent of the absolute file path. -fdebug-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. -fdebug-compilation-dir is |
| # designed to address this issue, making both debug info and the compile |
| # command itself independent of the absolute path of the build directory. |
| cflags = [ |
| "-fdebug-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", |
| ] |
| } |
| |
| rustflags = [ |
| "--remap-path-prefix", |
| rebase_path("//") + "=" + rebase_path("//", root_build_dir), |
| ] |
| } |
| |
| config("debug") { |
| # TODO(phosek): remove this config when nothing refers on it. |
| } |
| |
| 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("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. |
| # |
| # The linker_gc_$optimize configs are an exact parallel. default_linker_gc |
| # is separate from default_optimize so it can be removed separately. |
| |
| # NOTE: Keep in sync with //zircon/public/gn/config/BUILD.gn |
| |
| config("optimize_none") { |
| cflags = [ "-O0" ] |
| ldflags = cflags |
| rustflags = [ "-Copt-level=0" ] |
| } |
| |
| config("optimize_debug") { |
| if (false) { |
| # TODO(phosek): consider different settings to improve performance. |
| # -Og is what the compiler documents as "optimize the debugging |
| # experience", but zxdb team has reported Clang's -Og is problematic. |
| # This should have a bug# for a detailed bug about -Og and/or Rust-O1 |
| # making debugging difficult in known specific reproducible ways. |
| cflags = [ "-Og" ] |
| ldflags = cflags |
| rustflags = [ "-Copt-level=1" ] |
| } else { |
| configs = [ ":optimize_none" ] |
| } |
| } |
| |
| config("optimize_default") { |
| cflags = [ "-O2" ] |
| ldflags = cflags |
| rustflags = [ "-Copt-level=2" ] |
| } |
| |
| config("optimize_size") { |
| if (is_gcc) { |
| cflags = [ "-Os" ] |
| } else { |
| cflags = [ "-Oz" ] |
| } |
| ldflags = cflags |
| if (!is_gcc && clang_ml_inliner) { |
| cflags += [ |
| # `release` uses AOT model embedded inside the compiler. |
| "-mllvm", |
| "-enable-ml-inliner=release", |
| ] |
| } |
| rustflags = [ "-Copt-level=z" ] |
| configs = [ ":linker_string_merging" ] |
| } |
| |
| config("optimize_speed") { |
| cflags = [ "-O3" ] |
| ldflags = cflags |
| |
| # TODO(http://fxbug.dev/63313): This should be the same as for C/C++. Also, |
| # we don't fully understand why -Os is smaller than -Oz. |
| rustflags = [ "-Copt-level=s" ] |
| 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") { |
| # TODO(fxbug.dev/51509): Perhaps use a different default. |
| configs = [ ":optimize_none" ] |
| } |
| |
| config("default_optimize") { |
| configs = [ ":optimize_${optimize}" ] |
| } |
| |
| config("linker_gc_none") { |
| # No linker GC when wholly unoptimized. |
| } |
| |
| # Linker GC is a good default for most cases. |
| config("linker_gc_debug") { |
| configs = [ ":linker_gc" ] |
| } |
| |
| config("linker_gc_default") { |
| configs = [ ":linker_gc" ] |
| } |
| |
| config("linker_gc_size") { |
| configs = [ ":linker_gc" ] |
| } |
| |
| config("linker_gc_speed") { |
| configs = [ ":linker_gc" ] |
| } |
| |
| config("linker_gc_sanitizer") { |
| configs = [ ":linker_gc" ] |
| } |
| |
| config("linker_gc_profile") { |
| # TODO(fxbug.dev/51509): See if we can enable linker GC for profile. |
| } |
| |
| config("default_linker_gc") { |
| configs = [ ":linker_gc_$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. |
| |
| # NOTE: Keep in sync with //zircon/public/gn/config/BUILD.gn |
| |
| config("debuginfo_none") { |
| cflags = [ "-g0" ] |
| asmflags = cflags |
| ldflags = cflags |
| rustflags = [ "-Cdebuginfo=0" ] |
| } |
| |
| config("debuginfo_backtrace") { |
| cflags = [ "-g1" ] |
| asmflags = cflags |
| ldflags = cflags |
| rustflags = [ "-Cdebuginfo=1" ] |
| } |
| |
| config("debuginfo_debug") { |
| cflags = [ "-g3" ] |
| asmflags = cflags |
| ldflags = cflags |
| rustflags = [ "-Cdebuginfo=2" ] |
| } |
| |
| config("default_debuginfo") { |
| configs = [ ":debuginfo_${debuginfo}" ] |
| 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" ] |
| } |
| |
| 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. |
| } |
| |
| config("default_warnings") { |
| cflags = [ |
| "-Wall", |
| "-Wextra", |
| "-Wnewline-eof", |
| "-Wconversion", |
| "-Wno-unused-parameter", |
| "-Wno-unknown-warning-option", |
| "-Wno-sign-conversion", |
| |
| # TODO(fxbug.dev/35965): Temporarily disable C99 designator warnings introduced in |
| # https://reviews.llvm.org/D59754. After the new Clang toolchain lands |
| # and we do some cleanup, this will be re-enabled. |
| "-Wno-unknown-warning-option", |
| "-Wno-c99-designator", |
| |
| # TODO(fxbug.dev/37215): Temporarily disable this warning until we roll toolchain. |
| # Then we can re-enable it and cleanup instances it appears. |
| "-Wno-int-in-bool-context", |
| |
| # TODO(fxbug.dev/37765): Keep this flag here while it is enabled in ZN to keep the |
| # flags unified. |
| "-Wno-address-of-packed-member", |
| |
| # TODO(fxbug.dev/43681): Temporarily disable this warning until we roll toolchain, |
| # then come back and fix the instances this appears after rolling. |
| "-Wno-range-loop-analysis", |
| |
| # TODO(fxbug.dev/49143): Temporarily disable this warning until we disable it |
| # individually for affected third_party libraries. |
| "-Wno-deprecated-declarations", |
| ] |
| cflags_cc = [ |
| # TODO(fxbug.dev/38640): Keep this flag here while it is enabled in ZN to keep the |
| # flags unified. |
| "-Wno-deprecated-copy", |
| |
| # TODO(fxbug.dev/45689): Temporarily disable this warning until we roll toolchain, |
| # then come back and fix the instances this appears after rolling. |
| "-Wno-non-c-typedef-for-linkage", |
| |
| # TODO(fxbug.dev/56202): Temporarily disable this warning until we roll toolchain, |
| # then come back and fix the instances this appears after rolling. |
| "-Wno-unknown-warning-option", |
| "-Wno-suggest-override", |
| ] |
| } |
| |
| # TODO(fxbug.dev/58160): clean up instances of this outside of third party code. |
| config("Wno-reorder-init-list") { |
| cflags = [ "-Wno-reorder-init-list" ] |
| visibility = [ |
| "//garnet/examples/intl/wisdom/tests/*", |
| "//src/developer/memory/metrics/tests/*", |
| "//src/graphics/examples/vkcube/*", |
| "//src/graphics/lib/compute/tests/*", |
| "//src/graphics/tests/vkext/*", |
| "//src/lib/elflib/*", |
| "//src/lib/vulkan/tests/*", |
| "//src/modular/bin/basemgr/*", |
| "//src/modular/tests/*", |
| "//third_party/*", |
| ] |
| } |
| |
| # 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", |
| "//src/devices/i2c/drivers/intel-i2c", |
| "//zircon/third_party/uapp/dash", |
| ] |
| } |
| |
| # TODO(fxbug.dev/58162): clean up instances of this outside of third party code. |
| config("Wno-conversion") { |
| cflags = [ "-Wno-conversion" ] |
| visibility = [ |
| "//garnet/bin/catapult_converter/*", |
| "//garnet/bin/cpuperf/*", |
| "//garnet/bin/cpuperf_provider/*", |
| "//garnet/bin/insntrace/*", |
| "//garnet/bin/insntrace/tests/*", |
| "//garnet/bin/ktrace_provider/*", |
| "//garnet/bin/run_test_component/*", |
| "//garnet/bin/sched/*", |
| "//garnet/bin/test_runner/report_result/*", |
| "//garnet/bin/time/*", |
| "//garnet/bin/trace/*", |
| "//garnet/bin/trace2json/*", |
| "//garnet/bin/trace_manager/*", |
| "//garnet/bin/ui/benchmarks/*", |
| "//garnet/bin/ui/benchmarks/transparency_benchmark/*", |
| "//garnet/lib/debugger_utils/*", |
| "//garnet/lib/loader/*", |
| "//garnet/lib/perfmon/*", |
| "//garnet/lib/profiler/*", |
| "//garnet/lib/trace_converters/*", |
| "//garnet/public/lib/fostr/*", |
| "//garnet/public/lib/test_runner/cpp/*", |
| "//sdk/lib/media/audio/cpp/*", |
| "//sdk/lib/media/cpp/*", |
| "//sdk/lib/sys/cpp/*", |
| "//sdk/lib/sys/service/cpp/*", |
| "//sdk/lib/syslog/streams/cpp/*", |
| "//sdk/lib/ui/scenic/cpp/*", |
| "//sdk/lib/vfs/cpp/*", |
| "//src/bringup/bin/bootsvc/*", |
| "//src/bringup/bin/netsvc/*", |
| "//src/bringup/bin/ptysvc/*", |
| "//src/cobalt/bin/system-metrics/*", |
| "//src/cobalt/bin/testapp/*", |
| "//src/cobalt/bin/testing/*", |
| "//src/connectivity/bluetooth/core/bt-host/*", |
| "//src/connectivity/bluetooth/examples/bt-le-heart-rate-peripheral/*", |
| "//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:nc", |
| "//src/connectivity/openthread/drivers/ot-radio/*", |
| "//src/connectivity/openthread/ot-stack/*", |
| "//src/connectivity/openthread/tests/fake-drivers/fake-ot-radio/*", |
| "//src/connectivity/openthread/third_party/*", |
| "//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/*", |
| "//src/connectivity/wlan/drivers/realtek/rtl88xx/*", |
| "//src/connectivity/wlan/drivers/testing/lib/sim-env/*", |
| "//src/connectivity/wlan/drivers/third_party/*", |
| "//src/connectivity/wlan/lib/common/cpp/*", |
| "//src/connectivity/wlan/lib/mlme/cpp/*", |
| "//src/connectivity/wlan/testing/wlantap-driver/*", |
| "//src/developer/debug/third_party/libunwindstack/*", |
| "//src/developer/memory/mem/*", |
| "//src/developer/memory/metrics/*", |
| "//src/developer/memory/metrics/tests/*", |
| "//src/developer/memory/monitor/*", |
| "//src/developer/system_monitor/*", |
| "//src/developer/system_monitor/bin/harvester/*", |
| "//src/devices/usb/bin/lsusb/*", |
| "//src/diagnostics/validator/inspect/lib/cpp/*", |
| "//src/graphics/display/drivers/*", |
| "//src/graphics/display/drivers/display/*", |
| "//src/graphics/display/drivers/ssd1306/*", |
| "//src/graphics/display/testing/*", |
| "//src/graphics/drivers/misc/goldfish/*", |
| "//src/graphics/drivers/misc/goldfish_address_space/*", |
| "//src/graphics/lib/compute/common/*", |
| "//src/graphics/lib/compute/hotsort/hotsort_gen/*", |
| "//src/graphics/lib/compute/hotsort/platforms/vk/*", |
| "//src/graphics/lib/compute/spinel/*", |
| "//src/graphics/lib/compute/svg/*", |
| "//src/graphics/lib/compute/tests/*", |
| "//src/graphics/tests/goldfish_benchmark/*", |
| "//src/lib/backoff/*", |
| "//src/lib/chunked-compression/*", |
| "//src/lib/cobalt/cpp/*", |
| "//src/lib/containers/cpp/*", |
| "//src/lib/ddk/*", |
| "//src/lib/elflib/*", |
| "//src/lib/files/*", |
| "//src/lib/framebuffer/*", |
| "//src/lib/fsl/socket/*", |
| "//src/lib/fsl/vmo/*", |
| "//src/lib/fxl/*", |
| "//src/lib/icu/tools/extractor/*", |
| "//src/lib/inet/*", |
| "//src/lib/json_parser/*", |
| "//src/lib/line_input/*", |
| "//src/lib/listnode/*", |
| "//src/lib/process_builder/*", |
| "//src/lib/ui/input/*", |
| "//src/lib/ui/scenic/cpp/*", |
| "//src/lib/usb_bulk/cpp/*", |
| "//src/lib/vulkan/imagepipe_view/*", |
| "//src/lib/vulkan/tests/*", |
| "//src/media/audio/audio_core/*", |
| "//src/media/audio/audio_core/mixer/*", |
| "//src/media/audio/drivers/aml-g12-tdm/test/*", |
| "//src/media/audio/drivers/intel-hda/controller/*", |
| "//src/media/audio/drivers/virtual_audio/*", |
| "//src/media/audio/effects/test_effects/*", |
| "//src/media/audio/examples/effects/*", |
| "//src/media/audio/examples/fx/*", |
| "//src/media/audio/examples/simple_sine/*", |
| "//src/media/audio/examples/sync_sine/*", |
| "//src/media/audio/examples/tones/*", |
| "//src/media/audio/lib/analysis/*", |
| "//src/media/audio/lib/clock/*", |
| "//src/media/audio/lib/effects_loader/*", |
| "//src/media/audio/lib/format/*", |
| "//src/media/audio/lib/simple-audio-stream/*", |
| "//src/media/audio/lib/test/*", |
| "//src/media/audio/lib/timeline/*", |
| "//src/media/audio/lib/wav/*", |
| "//src/media/audio/tools/audio-capture-timestamp-validator/*", |
| "//src/media/audio/tools/audio-driver-ctl/*", |
| "//src/media/codec/codecs/*", |
| "//src/media/codec/examples/encode_camera/*", |
| "//src/media/codec/examples/encode_file/*", |
| "//src/media/codec/examples/use_media_decoder/*", |
| "//src/media/drivers/amlogic_decoder/*", |
| "//src/media/lib/codec_impl/*", |
| "//src/media/lib/test/*", |
| "//src/media/playback/mediaplayer/*", |
| "//src/media/playback/mediaplayer/demux/*", |
| "//src/media/playback/mediaplayer/graph/*", |
| "//src/media/playback/mediaplayer/metrics/*", |
| "//src/media/sounds/soundplayer/*", |
| "//src/modular/bin/sessionctl/*", |
| "//src/modular/bin/sessionmgr/*", |
| "//src/modular/lib/async/cpp/*", |
| "//src/modular/lib/fidl/*", |
| "//src/modular/lib/integration_testing/cpp/*", |
| "//src/power/thermd/*", |
| "//src/security/tee_manager/*", |
| "//src/storage/bin/dd/*", |
| "//src/storage/blobfs/*", |
| "//src/storage/blobfs/test/*", |
| "//src/storage/fvm/*", |
| "//src/storage/minfs/*", |
| "//src/storage/volume_image/ftl/*", |
| "//src/storage/volume_image/utils/*", |
| "//src/sys/activity/*", |
| "//src/sys/appmgr/*", |
| "//src/sys/bin/psutils/*", |
| "//src/sys/lib/chrealm/*", |
| "//src/sys/pkg/lib/far/*", |
| "//src/sys/sysmgr/*", |
| "//src/sys/tools/activity-ctl/*", |
| "//src/sys/tools/log/*", |
| "//src/testing/loadbench/*", |
| "//src/ui/a11y/bin/a11y_manager/tests/util/*", |
| "//src/ui/a11y/lib/annotation/*", |
| "//src/ui/a11y/lib/semantics/util/tests/*", |
| "//src/ui/a11y/lib/util/*", |
| "//src/ui/bin/root_presenter/*", |
| "//src/ui/examples/*", |
| "//src/ui/examples/bouncing_ball/*", |
| "//src/ui/examples/embedder/*", |
| "//src/ui/input/drivers/ft8201/*", |
| "//src/ui/input/drivers/pc-ps2/*", |
| "//src/ui/input/lib/hid-input-report/*", |
| "//src/ui/scenic/lib/display/*", |
| "//src/ui/scenic/lib/gfx/*", |
| "//src/ui/scenic/lib/scenic/util/*", |
| "//src/ui/scenic/lib/scheduling/*", |
| "//src/ui/scenic/lib/watchdog/*", |
| "//src/ui/tools/simple-touch/*", |
| "//src/ui/tools/tiles_ctl/*", |
| "//src/virtualization/bin/guest/*", |
| "//src/virtualization/bin/guest_manager/*", |
| "//src/virtualization/bin/vmm/*", |
| "//src/virtualization/bin/vmm/device/*", |
| "//src/virtualization/buildtools/*", |
| "//src/virtualization/lib/vsh/*", |
| "//src/virtualization/tests/*", |
| "//src/virtualization/third_party/fdt/*", |
| "//src/zircon/tests/evil/*", |
| "//third_party/*", |
| "//tools/bootserver_old/*", |
| "//tools/loglistener/*", |
| "//tools/netprotocol/*", |
| "//tools/vboot_reference/*", |
| "//vendor/*", |
| "//zircon/system/ulib/audio-utils-legacy/*", |
| "//zircon/system/ulib/audio-utils/*", |
| "//zircon/system/ulib/cobalt-client/*", |
| "//zircon/system/ulib/disk_inspector/*", |
| "//zircon/system/ulib/driver-info/*", |
| "//zircon/system/ulib/edid/*", |
| "//zircon/system/ulib/elf-search/*", |
| "//zircon/system/ulib/fs-host/*", |
| "//zircon/system/ulib/fs/*", |
| "//zircon/system/ulib/ftl/*", |
| "//zircon/system/ulib/hid-parser/*", |
| "//zircon/system/ulib/hid/*", |
| "//zircon/system/ulib/image-format/*", |
| "//zircon/system/ulib/inet6/*", |
| "//zircon/system/ulib/inspect/*", |
| "//zircon/system/ulib/inspector/*", |
| "//zircon/system/ulib/intel-hda/*", |
| "//zircon/system/ulib/ktrace/*", |
| "//zircon/system/ulib/launchpad/*", |
| "//zircon/system/ulib/log/*", |
| "//zircon/system/ulib/logger/*", |
| "//zircon/system/ulib/memfs/*", |
| "//zircon/system/ulib/mini-process/*", |
| "//zircon/system/ulib/profile/*", |
| "//zircon/system/ulib/ramdevice-client/*", |
| "//zircon/system/ulib/runtests-utils/*", |
| "//zircon/system/ulib/sysconfig-client/*", |
| "//zircon/system/ulib/syslog/*", |
| "//zircon/system/ulib/sysmem-version/*", |
| "//zircon/system/ulib/task-utils/*", |
| "//zircon/system/ulib/tee-client-api/*", |
| "//zircon/system/ulib/trace-engine/*", |
| "//zircon/system/ulib/trace-reader/*", |
| "//zircon/system/ulib/trace-test-utils/*", |
| "//zircon/system/ulib/trace/*", |
| "//zircon/system/ulib/unittest/*", |
| "//zircon/system/ulib/virtio/*", |
| "//zircon/system/ulib/zbi-bootfs/*", |
| "//zircon/system/ulib/zxio/*", |
| "//zircon/system/utest/msd/*", |
| "//zircon/third_party/*", |
| "//zircon/tools/blobfs/*", |
| "//zircon/tools/ktrace-dump/*", |
| "//zircon/tools/lz4/*", |
| "//zircon/tools/merkleroot/*", |
| "//zircon/tools/minfs/*", |
| "//zircon/tools/mtd-redundant-storage/*", |
| "//zircon/tools/xdc-server/*", |
| ] |
| } |
| |
| # TODO(fxbug.dev/58162): clean up instances of this outside of third party code. |
| # This is the same as "Wno-conversion" above but without a visibility list. |
| # This in turn allows us to have generated code depend on this config. Having |
| # an explicit allowlist for generated code (e.g. fidl_cpp template expansions) |
| # is not practical. |
| # Please use with care, or not at all. |
| config("Wno-conversion-generated") { |
| cflags = [ "-Wno-conversion" ] |
| } |
| |
| 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" ] |
| } |
| |
| config("symbol_no_undefined") { |
| if (current_os == "mac") { |
| ldflags = [ "-Wl,-undefined,error" ] |
| } else { |
| ldflags = [ "-Wl,--no-undefined" ] |
| } |
| } |
| |
| config("shared_library_config") { |
| configs = [] |
| cflags = [] |
| |
| 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("no-shadow-call-stack") { |
| if (current_cpu == "arm64") { |
| cflags = [ "-fsanitize=no-shadow-call-stack" ] |
| } |
| } |
| |
| # Defines a Rust cfg flag with the value of the rust_panic build arg. |
| # Useful for changing behavior of code based on panic behavior. |
| config("rust_panic_cfg") { |
| rustflags = [ "--cfg=rust_panic=\"${rust_panic}\"" ] |
| } |
| |
| 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 |
| } |
| rustflags = [ "-Dwarnings" ] |
| } |
| |
| config("temporarily_disable_ubsan_do_not_use") { |
| cflags = [ "-fno-sanitize=undefined" ] |
| } |
| |
| config("no_stack_protector") { |
| cflags = [ "-fno-stack-protector" ] |
| } |
| |
| config("no_sanitizers") { |
| cflags = [ |
| "-fno-sanitize=all", |
| "-fsanitize-coverage=0", |
| ] |
| configs = [ ":no_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", |
| ] |
| } |
| |
| # IMPORTANT: Keep the configs below in sync with //zircon/public/gn/config/BUILD.zircon.gn |
| # TODO(fxbug.dev/54322): Remove above comment after build unification. |
| |
| 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("thread_safety_annotations") { |
| if (!is_gcc) { |
| cflags = [ "-Wthread-safety" ] |
| defines = [ "_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS" ] |
| } |
| } |
| |
| # Tools that must be executed locally. |
| pool("local") { |
| depth = default_concurrent_jobs.local |
| } |