| # Copyright 2019 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. |
| |
| config("visibility_hidden") { |
| cflags = [ "-fvisibility=hidden" ] |
| cflags_cc = [ "-fvisibility-inlines-hidden" ] |
| } |
| |
| config("static-libc++") { |
| if (is_fuchsia) { |
| configs = [ "//build/config/fuchsia:static_cpp_standard_library" ] |
| } |
| } |
| |
| config("default_include_dirs") { |
| # Note: this include directory is also provided by the sysroot, but it is |
| # needed when compiling some libraries in the host toolchain. |
| include_dirs = [ "//zircon/system/public" ] |
| } |
| |
| # These warnings were picked up from the ZN build. |
| # TODO(3203): that list should converge with regular compilation settings in the GN build. |
| config("default_warnings") { |
| cflags = [ |
| "-Wall", |
| "-Wextra", |
| "-Wno-multichar", |
| "-Wno-unused-parameter", |
| "-Wno-unused-function", |
| "-Werror=unused-label", |
| "-Werror=return-type", |
| "-Wno-address-of-packed-member", |
| ] |
| cflags_c = [ |
| "-Werror=implicit-function-declaration", |
| "-Wstrict-prototypes", |
| "-Wwrite-strings", |
| "-Wno-absolute-value", |
| ] |
| cflags_cc = [ |
| "-Wconversion", |
| "-Wno-sign-conversion", |
| "-Wextra-semi", |
| ] |
| } |
| |
| config("user") { |
| defines = [ "_ALL_SOURCE" ] |
| } |
| |
| config("freestanding") { |
| cflags = [ "-ffreestanding" ] |
| |
| # In Clang -fasynchronous-unwind-tables is the default for *-fuchsia |
| # targets. But -ffreestanding defeats that (in target-independent logic |
| # in the Clang driver). So add it back explicitly. For GCC, it's |
| # already added explicitly in :compiler regardless so don't double it. |
| cflags += [ "-fasynchronous-unwind-tables" ] |
| |
| ldflags = cflags |
| } |
| |
| config("no_stack_protector") { |
| cflags = [ "-fno-stack-protector" ] |
| } |
| |
| config("no_sanitizers") { |
| cflags = [ |
| "-fno-sanitize=all", |
| "-fsanitize-coverage=0", |
| ] |
| configs = [ ":no_stack_protector" ] |
| } |
| |
| config("no-shadow-call-stack") { |
| if (current_cpu == "arm64") { |
| cflags = [ "-fno-sanitize=shadow-call-stack" ] |
| } |
| } |
| |
| # TODO(TC-539) Remove this once the warning with fit::variant/fit::optional is addressed. |
| config("no_maybe_uninitialized") { |
| } |
| |
| config("no_safestack") { |
| cflags = [ "-fno-sanitize=safe-stack" ] |
| configs = [ ":no_stack_protector" ] |
| } |