Update BUILD.gns
This commit is contained in:
parent
0cf8fbc784
commit
0fbbd55cf4
14 changed files with 455 additions and 291 deletions
|
@ -125,29 +125,58 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
}
|
||||
}
|
||||
} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") {
|
||||
# arm64 supports only "hard".
|
||||
arm_version = 8
|
||||
arm_float_abi = "hard"
|
||||
arm_use_neon = true
|
||||
declare_args() {
|
||||
# Enables the new Armv8 branch protection features. Valid strings are:
|
||||
# - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3)
|
||||
# - "standard": Enables both PAC and Branch Target Identification (Armv8.5).
|
||||
# - "none": No branch protection.
|
||||
arm_control_flow_integrity = "standard"
|
||||
arm_control_flow_integrity = "none"
|
||||
|
||||
# Version of the ARM processor when compiling on ARM. Ignored on non-ARM
|
||||
# platforms.
|
||||
arm_version = 8
|
||||
|
||||
# arm64 supports only "hard".
|
||||
arm_float_abi = "hard"
|
||||
|
||||
# TODO(cavalcantii): enable the feature for the following OSes next.
|
||||
if (is_mac || is_chromeos || is_fuchsia || is_win ||
|
||||
target_cpu != "arm64") {
|
||||
# target_cpu != "arm64" covers some cases (e.g. the ChromeOS x64 MSAN
|
||||
# build) where the target platform is x64, but V8 is configured to use
|
||||
# the arm64 simulator. Pointer authentication doesn't work properly
|
||||
# in this mode (yet).
|
||||
arm_control_flow_integrity = "none"
|
||||
# The ARM64 architecture. This will be a string like "armv8-a" or "armv8.5-a.
|
||||
# An empty string means to use the default for the arm_version.
|
||||
arm_arch = "armv8-a"
|
||||
|
||||
# The ARM variant-specific tuning mode. This will be a string like "armv6"
|
||||
# or "cortex-a15". An empty string means to use the default for the
|
||||
# arm_version.
|
||||
arm_tune = "generic-armv8-a"
|
||||
|
||||
# The ARM64 floating point hardware. This will be a string like "neon" or
|
||||
# "vfpv3-d16". An empty string means to use the default for the arm_version.
|
||||
arm_fpu = "neon"
|
||||
|
||||
# Whether to use the neon FPU instruction set or not.
|
||||
arm_use_neon = "true"
|
||||
|
||||
# Whether to enable optional NEON code paths.
|
||||
arm_optionally_use_neon = false
|
||||
|
||||
# Thumb is a reduced instruction set available on some ARM processors that
|
||||
# has increased code density.
|
||||
arm_use_thumb = true
|
||||
|
||||
if ((is_android || is_linux) && target_cpu == "arm64") {
|
||||
# Enable PAC and BTI on AArch64 Linux/Android systems.
|
||||
# target_cpu == "arm64" filters out some cases (e.g. the ChromeOS x64
|
||||
# MSAN build) where the target platform is x64, but V8 is configured to
|
||||
# use the arm64 simulator.
|
||||
arm_control_flow_integrity = "standard"
|
||||
}
|
||||
}
|
||||
# Initial values from upstream.
|
||||
arm_version = 8
|
||||
arm_float_abi = "hard"
|
||||
arm_use_neon = true
|
||||
|
||||
assert(arm_control_flow_integrity == "none" ||
|
||||
arm_control_flow_integrity == "standard" ||
|
||||
arm_control_flow_integrity == "pac",
|
||||
"Invalid branch protection option")
|
||||
"Invalid ARM branch protection option.")
|
||||
}
|
||||
|
|
|
@ -133,9 +133,9 @@ declare_args() {
|
|||
# recognizable in the debugger, and crashes on memory accesses through
|
||||
# uninitialized pointers.
|
||||
#
|
||||
# TODO(crbug.com/1131993): Enabling this when 'is_android' is true breaks
|
||||
# content_shell_test_apk on both ARM and x86.
|
||||
init_stack_vars = !is_android
|
||||
# TODO(crbug.com/1131993): This regresses binary size by ~1MB on Android and
|
||||
# needs to be evaluated before enabling it there as well.
|
||||
init_stack_vars = !(is_android && is_official_build)
|
||||
|
||||
# This argument is to control whether enabling text section splitting in the
|
||||
# final binary. When enabled, the separated text sections with prefix
|
||||
|
@ -642,6 +642,11 @@ config("compiler") {
|
|||
cflags_cc += [ "-Wno-trigraphs" ]
|
||||
}
|
||||
|
||||
if (use_relative_vtables_abi) {
|
||||
cflags_cc += [ "-fexperimental-relative-c++-abi-vtables" ]
|
||||
ldflags += [ "-fexperimental-relative-c++-abi-vtables" ]
|
||||
}
|
||||
|
||||
# Add flags for link-time optimization. These flags enable
|
||||
# optimizations/transformations that require whole-program visibility at link
|
||||
# time, so they need to be applied to all translation units, and we may end up
|
||||
|
@ -733,7 +738,7 @@ config("compiler") {
|
|||
}
|
||||
|
||||
if (is_win && target_cpu == "arm64") {
|
||||
cflags += [ "-O3", "-Wno-error", "-Wno-unreachable-code", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "-Wno-error", "-Wno-unreachable-code", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
|
||||
if (is_linux && target_cpu == "arm64") {
|
||||
|
@ -866,6 +871,10 @@ config("compiler") {
|
|||
# we discover a reason to turn them off.
|
||||
"-Coverflow-checks=on",
|
||||
|
||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||
# The equivalent of -Werror for clang/gcc.
|
||||
"-Dwarnings",
|
||||
|
||||
# To make Rust .d files compatible with ninja
|
||||
"-Zdep-info-omit-d-target",
|
||||
|
||||
|
@ -954,6 +963,12 @@ config("compiler_cpu_abi") {
|
|||
configs += [ "//build/config/chromeos:compiler_cpu_abi" ]
|
||||
}
|
||||
|
||||
# TODO(https://crbug.com/1383873): Remove this once figured out.
|
||||
if (is_apple && current_cpu == "arm64") {
|
||||
cflags += [ "-fno-global-isel" ]
|
||||
ldflags += [ "-fno-global-isel" ]
|
||||
}
|
||||
|
||||
if ((is_posix && !is_apple) || is_fuchsia) {
|
||||
# CPU architecture. We may or may not be doing a cross compile now, so for
|
||||
# simplicity we always explicitly set the architecture.
|
||||
|
@ -1819,37 +1834,9 @@ config("no_chromium_code") {
|
|||
}
|
||||
}
|
||||
|
||||
# Rust warnings to ignore in third party dependencies. This list is
|
||||
# built from those warnings which are currently in our various Rust
|
||||
# third party dependencies, but aren't serious (they're largely
|
||||
# stylistic).
|
||||
# An alternative policy would be to suppress all warnings in third
|
||||
# party Rust code using "--cap-lints allow". This is what cargo does
|
||||
# for code outside your own crate, so is worth considering if it
|
||||
# turns out that maintaining this list is onerous.
|
||||
# (https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints)
|
||||
rustflags = [
|
||||
"-A",
|
||||
"unused_parens",
|
||||
"-A",
|
||||
"bare_trait_objects",
|
||||
"-A",
|
||||
"non_fmt_panics",
|
||||
"-A",
|
||||
"redundant_semicolons",
|
||||
"-A",
|
||||
"unused_parens",
|
||||
"-A",
|
||||
"anonymous_parameters",
|
||||
"-A",
|
||||
"bare_trait_objects",
|
||||
"-A",
|
||||
"deprecated",
|
||||
"-A",
|
||||
"non_camel_case_types",
|
||||
"-A",
|
||||
"unused_imports",
|
||||
]
|
||||
# Suppress all warnings in third party, as Cargo does:
|
||||
# https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints
|
||||
rustflags = [ "--cap-lints=allow" ]
|
||||
|
||||
configs = [ ":default_warnings" ]
|
||||
}
|
||||
|
@ -2053,7 +2040,7 @@ if (is_win) {
|
|||
"-mllvm", "-unroll-runtime-multi-exit",
|
||||
"-mllvm", "-aggressive-ext-opt",
|
||||
"-mllvm", "-enable-interleaved-mem-accesses",
|
||||
"/O3",
|
||||
"/O2",
|
||||
"/clang:-O3",
|
||||
"/clang:-mavx",
|
||||
"/clang:-maes",
|
||||
|
@ -2202,10 +2189,16 @@ config("optimize") {
|
|||
# Favor size over speed, /O1 must be before the common flags.
|
||||
# /O1 implies /Os and /GF.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else {
|
||||
# PGO requires all translation units to be compiled with /O2. The actual
|
||||
# optimization level will be decided based on the profiling data.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
|
||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||
# to optimize for performance like `/O2` for clang.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
}
|
||||
} else if (optimize_for_size) {
|
||||
# Favor size over speed.
|
||||
|
@ -2221,6 +2214,10 @@ config("optimize") {
|
|||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
}
|
||||
|
||||
# Like with `-Oz` on Clang, `-Copt-level=z` will also turn off loop
|
||||
# vectorization.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else if (is_chromeos) {
|
||||
# TODO(gbiv): This is partially favoring size over speed. CrOS exclusively
|
||||
# uses clang, and -Os in clang is more of a size-conscious -O2 than "size at
|
||||
|
@ -2229,13 +2226,17 @@ config("optimize") {
|
|||
# for size by default (so, also Windows)
|
||||
# - Investigate -Oz here, maybe just for ARM?
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
|
||||
# Similar to clang, we optimize with `-Copt-level=s` to keep loop
|
||||
# vectorization while otherwise optimizing for size.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
}
|
||||
if (optimize_for_size) {
|
||||
rustflags = [ "-Copt-level=3", ]
|
||||
} else {
|
||||
rustflags = [ "-Copt-level=3", ]
|
||||
|
||||
# The `-O3` for clang turns on extra optimizations compared to the standard
|
||||
# `-O2`. But for rust, `-Copt-level=3` is the default and is thus reliable
|
||||
# to use.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
}
|
||||
ldflags = common_optimize_on_ldflags
|
||||
}
|
||||
|
@ -2463,7 +2464,14 @@ config("win_pdbaltpath") {
|
|||
config("symbols") {
|
||||
if (is_win) {
|
||||
if (is_clang) {
|
||||
cflags = [ "/Z7" ] # Debug information in the .obj files.
|
||||
cflags = [
|
||||
# Debug information in the .obj files.
|
||||
"/Z7",
|
||||
|
||||
# Disable putting the compiler command line into the debug info to
|
||||
# prevent some types of non-determinism.
|
||||
"-gno-codeview-command-line",
|
||||
]
|
||||
} else {
|
||||
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
|
||||
}
|
||||
|
@ -2746,7 +2754,16 @@ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
|
|||
config("default_init_stack_vars") {
|
||||
cflags = []
|
||||
if (init_stack_vars && is_clang && !is_nacl && !using_sanitizer) {
|
||||
cflags += [ "-ftrivial-auto-var-init=pattern" ]
|
||||
if (is_chromeos && !chromeos_is_browser_only) {
|
||||
# TODO(adriandole) remove chromeos_is_browser_only condition
|
||||
# once lacros updates toolchain
|
||||
|
||||
# Zero init has favorable performance/size tradeoffs for Chrome OS
|
||||
# but was not evaluated for other platforms.
|
||||
cflags += [ "-ftrivial-auto-var-init=zero" ]
|
||||
} else {
|
||||
cflags += [ "-ftrivial-auto-var-init=pattern" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -112,16 +112,16 @@ config("compiler") {
|
|||
if (host_cpu == "x86" || host_cpu == "x64") {
|
||||
cflags += [ "-m32" ]
|
||||
} else {
|
||||
cflags += [ "--target=i386-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=i386-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
} else if (current_cpu == "x64") {
|
||||
if (host_cpu == "x86" || host_cpu == "x64") {
|
||||
cflags += [ "-m64" ]
|
||||
} else {
|
||||
cflags += [ "--target=x86_64-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=x86_64-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
} else if (current_cpu == "arm64") {
|
||||
cflags += [ "--target=arm64-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", "-Wno-error", "-Xclang", "-Wno-unused-command-line-argument", "-Xclang", "-Wno-error", "/clang:-Wno-unused-command-line-argument", "/clang:-Wno-error", ]
|
||||
cflags += [ "--target=arm64-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
} else {
|
||||
assert(false, "unknown current_cpu " + current_cpu)
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ config("compiler") {
|
|||
# "/fp:fast", enables FMA.
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
cflags += [
|
||||
"/O3",
|
||||
"/O2",
|
||||
"-mavx",
|
||||
"-maes",
|
||||
"-mvaes",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2022 The Chromium Authors and Alex313031.
|
||||
# Copyright 2023 The Chromium Authors and Alex313031.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
@ -29,10 +29,10 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
arm_tune = "generic-armv8.5-a"
|
||||
|
||||
# Whether to use the neon FPU instruction set or not.
|
||||
arm_use_neon = true
|
||||
arm_use_neon = "true"
|
||||
|
||||
# Whether to enable optional NEON code paths.
|
||||
arm_optionally_use_neon = true
|
||||
arm_optionally_use_neon = false
|
||||
|
||||
# Thumb is a reduced instruction set available on some ARM processors that
|
||||
# has increased code density.
|
||||
|
@ -120,39 +120,68 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
if (arm_use_neon) {
|
||||
arm_fpu = "neon"
|
||||
} else {
|
||||
arm_fpu = "neon"
|
||||
arm_fpu = "vfpv3-d16"
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") {
|
||||
# arm64 supports only "hard".
|
||||
declare_args() {
|
||||
# Enables the new Armv8 branch protection features. Valid strings are:
|
||||
# - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3)
|
||||
# - "standard": Enables both PAC and Branch Target Identification (Armv8.5).
|
||||
# - "none": No branch protection.
|
||||
arm_control_flow_integrity = "none"
|
||||
|
||||
# Version of the ARM processor when compiling on ARM. Ignored on non-ARM
|
||||
# platforms.
|
||||
arm_version = 8
|
||||
|
||||
# arm64 supports only "hard".
|
||||
arm_float_abi = "hard"
|
||||
|
||||
# The ARM64 architecture. This will be a string like "armv8-a" or "armv8.5-a.
|
||||
# An empty string means to use the default for the arm_version.
|
||||
arm_arch = "armv8.5-a"
|
||||
|
||||
# The ARM variant-specific tuning mode. This will be a string like "armv6"
|
||||
# or "cortex-a15". An empty string means to use the default for the
|
||||
# arm_version.
|
||||
arm_tune = "generic-armv8.5-a"
|
||||
|
||||
# The ARM64 floating point hardware. This will be a string like "neon" or
|
||||
# "vfpv3-d16". An empty string means to use the default for the arm_version.
|
||||
arm_fpu = "neon"
|
||||
|
||||
# Whether to use the neon FPU instruction set or not.
|
||||
arm_use_neon = "true"
|
||||
|
||||
# Whether to enable optional NEON code paths.
|
||||
arm_optionally_use_neon = false
|
||||
|
||||
# Thumb is a reduced instruction set available on some ARM processors that
|
||||
# has increased code density.
|
||||
arm_use_thumb = true
|
||||
|
||||
if ((is_android || is_linux) && target_cpu == "arm64") {
|
||||
# Enable PAC and BTI on AArch64 Linux/Android systems.
|
||||
# target_cpu == "arm64" filters out some cases (e.g. the ChromeOS x64
|
||||
# MSAN build) where the target platform is x64, but V8 is configured to
|
||||
# use the arm64 simulator.
|
||||
arm_control_flow_integrity = "standard"
|
||||
}
|
||||
}
|
||||
# Initial values from upstream.
|
||||
arm_version = 8
|
||||
arm_float_abi = "hard"
|
||||
arm_arch = "armv8.5-a"
|
||||
arm_fpu = "neon"
|
||||
arm_tune = "generic-armv8.5-a"
|
||||
arm_use_neon = true
|
||||
arm_optionally_use_neon = true
|
||||
arm_optionally_use_neon = false
|
||||
arm_use_thumb = true
|
||||
declare_args() {
|
||||
# Enables the new Armv8 branch protection features. Valid strings are:
|
||||
# - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3)
|
||||
# - "standard": Enables both PAC and Branch Target Identification (Armv8.5).
|
||||
# - "none": No branch protection.
|
||||
arm_control_flow_integrity = "standard"
|
||||
|
||||
# TODO(cavalcantii): enable the feature for the following OSes next.
|
||||
if (is_mac || is_chromeos || is_fuchsia || is_win ||
|
||||
target_cpu != "arm64") {
|
||||
# target_cpu != "arm64" covers some cases (e.g. the ChromeOS x64 MSAN
|
||||
# build) where the target platform is x64, but V8 is configured to use
|
||||
# the arm64 simulator. Pointer authentication doesn't work properly
|
||||
# in this mode (yet).
|
||||
arm_control_flow_integrity = "none"
|
||||
}
|
||||
}
|
||||
|
||||
assert(arm_control_flow_integrity == "none" ||
|
||||
arm_control_flow_integrity == "standard" ||
|
||||
arm_control_flow_integrity == "pac",
|
||||
"Invalid branch protection option")
|
||||
"Invalid ARM branch protection option.")
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2022 The Chromium Authors and Alex313031.
|
||||
# Copyright 2023 The Chromium Authors and Alex313031.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
@ -32,7 +32,7 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
arm_tune = "cortex-a72"
|
||||
|
||||
# Whether to use the neon FPU instruction set or not.
|
||||
arm_use_neon = true
|
||||
arm_use_neon = "true"
|
||||
|
||||
# Whether to enable optional NEON code paths.
|
||||
arm_optionally_use_neon = true
|
||||
|
@ -123,12 +123,57 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
if (arm_use_neon) {
|
||||
arm_fpu = "neon-vfpv4"
|
||||
} else {
|
||||
arm_fpu = "neon-vfpv4"
|
||||
arm_fpu = "vfpv3-d16"
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") {
|
||||
# arm64 supports only "hard".
|
||||
declare_args() {
|
||||
# Enables the new Armv8 branch protection features. Valid strings are:
|
||||
# - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3)
|
||||
# - "standard": Enables both PAC and Branch Target Identification (Armv8.5).
|
||||
# - "none": No branch protection.
|
||||
arm_control_flow_integrity = "none"
|
||||
|
||||
# Version of the ARM processor when compiling on ARM. Ignored on non-ARM
|
||||
# platforms.
|
||||
arm_version = 8
|
||||
|
||||
# arm64 supports only "hard".
|
||||
arm_float_abi = "hard"
|
||||
|
||||
# The ARM64 architecture. This will be a string like "armv8-a" or "armv8.5-a.
|
||||
# An empty string means to use the default for the arm_version.
|
||||
arm_arch = "armv8-a"
|
||||
|
||||
# The ARM variant-specific tuning mode. This will be a string like "armv6"
|
||||
# or "cortex-a15". An empty string means to use the default for the
|
||||
# arm_version.
|
||||
arm_tune = "cortex-a72"
|
||||
|
||||
# The ARM64 floating point hardware. This will be a string like "neon" or
|
||||
# "vfpv3-d16". An empty string means to use the default for the arm_version.
|
||||
arm_fpu = "neon"
|
||||
|
||||
# Whether to use the neon FPU instruction set or not.
|
||||
arm_use_neon = "true"
|
||||
|
||||
# Whether to enable optional NEON code paths.
|
||||
arm_optionally_use_neon = true
|
||||
|
||||
# Thumb is a reduced instruction set available on some ARM processors that
|
||||
# has increased code density.
|
||||
arm_use_thumb = true
|
||||
|
||||
if ((is_android || is_linux) && target_cpu == "arm64") {
|
||||
# Enable PAC and BTI on AArch64 Linux/Android systems.
|
||||
# target_cpu == "arm64" filters out some cases (e.g. the ChromeOS x64
|
||||
# MSAN build) where the target platform is x64, but V8 is configured to
|
||||
# use the arm64 simulator.
|
||||
arm_control_flow_integrity = "standard"
|
||||
}
|
||||
}
|
||||
# Initial values from upstream.
|
||||
arm_version = 8
|
||||
arm_float_abi = "hard"
|
||||
arm_arch = "armv8-a"
|
||||
|
@ -137,25 +182,9 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
arm_use_neon = true
|
||||
arm_optionally_use_neon = true
|
||||
arm_use_thumb = true
|
||||
declare_args() {
|
||||
# Enables the new Armv8 branch protection features. Valid strings are:
|
||||
# - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3)
|
||||
# - "standard": Enables both PAC and Branch Target Identification (Armv8.5).
|
||||
# - "none": No branch protection.
|
||||
arm_control_flow_integrity = "standard"
|
||||
|
||||
# TODO(cavalcantii): enable the feature for the following OSes next.
|
||||
if (is_mac || is_chromeos || is_fuchsia || is_win ||
|
||||
target_cpu != "arm64") {
|
||||
# target_cpu != "arm64" covers some cases (e.g. the ChromeOS x64 MSAN
|
||||
# build) where the target platform is x64, but V8 is configured to use
|
||||
# the arm64 simulator. Pointer authentication doesn't work properly
|
||||
# in this mode (yet).
|
||||
arm_control_flow_integrity = "none"
|
||||
}
|
||||
}
|
||||
|
||||
assert(arm_control_flow_integrity == "none" ||
|
||||
arm_control_flow_integrity == "standard" ||
|
||||
arm_control_flow_integrity == "pac",
|
||||
"Invalid branch protection option")
|
||||
"Invalid ARM branch protection option.")
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2022 The Chromium Authors and Alex313031.
|
||||
# Copyright 2023 The Chromium Authors and Alex313031.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
@ -29,7 +29,7 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
arm_tune = "generic-armv8-a"
|
||||
|
||||
# Whether to use the neon FPU instruction set or not.
|
||||
arm_use_neon = false
|
||||
arm_use_neon = "false"
|
||||
|
||||
# Whether to enable optional NEON code paths.
|
||||
arm_optionally_use_neon = false
|
||||
|
@ -52,7 +52,7 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
# The ARM floating point mode. This is either the string "hard", "soft",
|
||||
# or "softfp". An empty string means to use the default one for the
|
||||
# arm_version.
|
||||
arm_float_abi = "hard"
|
||||
arm_float_abi = ""
|
||||
}
|
||||
}
|
||||
assert(arm_float_abi == "" || arm_float_abi == "hard" ||
|
||||
|
@ -125,7 +125,52 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
}
|
||||
}
|
||||
} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") {
|
||||
# arm64 supports only "hard".
|
||||
declare_args() {
|
||||
# Enables the new Armv8 branch protection features. Valid strings are:
|
||||
# - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3)
|
||||
# - "standard": Enables both PAC and Branch Target Identification (Armv8.5).
|
||||
# - "none": No branch protection.
|
||||
arm_control_flow_integrity = "none"
|
||||
|
||||
# Version of the ARM processor when compiling on ARM. Ignored on non-ARM
|
||||
# platforms.
|
||||
arm_version = 8
|
||||
|
||||
# arm64 supports only "hard".
|
||||
arm_float_abi = "hard"
|
||||
|
||||
# The ARM64 architecture. This will be a string like "armv8-a" or "armv8.5-a.
|
||||
# An empty string means to use the default for the arm_version.
|
||||
arm_arch = "armv8-a"
|
||||
|
||||
# The ARM variant-specific tuning mode. This will be a string like "armv6"
|
||||
# or "cortex-a15". An empty string means to use the default for the
|
||||
# arm_version.
|
||||
arm_tune = "generic-armv8-a"
|
||||
|
||||
# The ARM64 floating point hardware. This will be a string like "neon" or
|
||||
# "vfpv3-d16". An empty string means to use the default for the arm_version.
|
||||
arm_fpu = "vfpv3-d16"
|
||||
|
||||
# Whether to use the neon FPU instruction set or not.
|
||||
arm_use_neon = "false"
|
||||
|
||||
# Whether to enable optional NEON code paths.
|
||||
arm_optionally_use_neon = false
|
||||
|
||||
# Thumb is a reduced instruction set available on some ARM processors that
|
||||
# has increased code density.
|
||||
arm_use_thumb = true
|
||||
|
||||
if ((is_android || is_linux) && target_cpu == "arm64") {
|
||||
# Enable PAC and BTI on AArch64 Linux/Android systems.
|
||||
# target_cpu == "arm64" filters out some cases (e.g. the ChromeOS x64
|
||||
# MSAN build) where the target platform is x64, but V8 is configured to
|
||||
# use the arm64 simulator.
|
||||
arm_control_flow_integrity = "standard"
|
||||
}
|
||||
}
|
||||
# Initial values from upstream.
|
||||
arm_version = 8
|
||||
arm_float_abi = "hard"
|
||||
arm_arch = "armv8-a"
|
||||
|
@ -134,25 +179,9 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
|
|||
arm_use_neon = false
|
||||
arm_optionally_use_neon = false
|
||||
arm_use_thumb = true
|
||||
declare_args() {
|
||||
# Enables the new Armv8 branch protection features. Valid strings are:
|
||||
# - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3)
|
||||
# - "standard": Enables both PAC and Branch Target Identification (Armv8.5).
|
||||
# - "none": No branch protection.
|
||||
arm_control_flow_integrity = "standard"
|
||||
|
||||
# TODO(cavalcantii): enable the feature for the following OSes next.
|
||||
if (is_mac || is_chromeos || is_fuchsia || is_win ||
|
||||
target_cpu != "arm64") {
|
||||
# target_cpu != "arm64" covers some cases (e.g. the ChromeOS x64 MSAN
|
||||
# build) where the target platform is x64, but V8 is configured to use
|
||||
# the arm64 simulator. Pointer authentication doesn't work properly
|
||||
# in this mode (yet).
|
||||
arm_control_flow_integrity = "none"
|
||||
}
|
||||
}
|
||||
|
||||
assert(arm_control_flow_integrity == "none" ||
|
||||
arm_control_flow_integrity == "standard" ||
|
||||
arm_control_flow_integrity == "pac",
|
||||
"Invalid branch protection option")
|
||||
"Invalid ARM branch protection option.")
|
||||
}
|
||||
|
|
|
@ -133,9 +133,9 @@ declare_args() {
|
|||
# recognizable in the debugger, and crashes on memory accesses through
|
||||
# uninitialized pointers.
|
||||
#
|
||||
# TODO(crbug.com/1131993): Enabling this when 'is_android' is true breaks
|
||||
# content_shell_test_apk on both ARM and x86.
|
||||
init_stack_vars = !is_android
|
||||
# TODO(crbug.com/1131993): This regresses binary size by ~1MB on Android and
|
||||
# needs to be evaluated before enabling it there as well.
|
||||
init_stack_vars = !(is_android && is_official_build)
|
||||
|
||||
# This argument is to control whether enabling text section splitting in the
|
||||
# final binary. When enabled, the separated text sections with prefix
|
||||
|
@ -635,6 +635,11 @@ config("compiler") {
|
|||
cflags_cc += [ "-Wno-trigraphs" ]
|
||||
}
|
||||
|
||||
if (use_relative_vtables_abi) {
|
||||
cflags_cc += [ "-fexperimental-relative-c++-abi-vtables" ]
|
||||
ldflags += [ "-fexperimental-relative-c++-abi-vtables" ]
|
||||
}
|
||||
|
||||
# Add flags for link-time optimization. These flags enable
|
||||
# optimizations/transformations that require whole-program visibility at link
|
||||
# time, so they need to be applied to all translation units, and we may end up
|
||||
|
@ -850,6 +855,10 @@ config("compiler") {
|
|||
# we discover a reason to turn them off.
|
||||
"-Coverflow-checks=on",
|
||||
|
||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||
# The equivalent of -Werror for clang/gcc.
|
||||
"-Dwarnings",
|
||||
|
||||
# To make Rust .d files compatible with ninja
|
||||
"-Zdep-info-omit-d-target",
|
||||
|
||||
|
@ -938,6 +947,12 @@ config("compiler_cpu_abi") {
|
|||
configs += [ "//build/config/chromeos:compiler_cpu_abi" ]
|
||||
}
|
||||
|
||||
# TODO(https://crbug.com/1383873): Remove this once figured out.
|
||||
if (is_apple && current_cpu == "arm64") {
|
||||
cflags += [ "-fno-global-isel" ]
|
||||
ldflags += [ "-fno-global-isel" ]
|
||||
}
|
||||
|
||||
if ((is_posix && !is_apple) || is_fuchsia) {
|
||||
# CPU architecture. We may or may not be doing a cross compile now, so for
|
||||
# simplicity we always explicitly set the architecture.
|
||||
|
@ -1803,37 +1818,9 @@ config("no_chromium_code") {
|
|||
}
|
||||
}
|
||||
|
||||
# Rust warnings to ignore in third party dependencies. This list is
|
||||
# built from those warnings which are currently in our various Rust
|
||||
# third party dependencies, but aren't serious (they're largely
|
||||
# stylistic).
|
||||
# An alternative policy would be to suppress all warnings in third
|
||||
# party Rust code using "--cap-lints allow". This is what cargo does
|
||||
# for code outside your own crate, so is worth considering if it
|
||||
# turns out that maintaining this list is onerous.
|
||||
# (https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints)
|
||||
rustflags = [
|
||||
"-A",
|
||||
"unused_parens",
|
||||
"-A",
|
||||
"bare_trait_objects",
|
||||
"-A",
|
||||
"non_fmt_panics",
|
||||
"-A",
|
||||
"redundant_semicolons",
|
||||
"-A",
|
||||
"unused_parens",
|
||||
"-A",
|
||||
"anonymous_parameters",
|
||||
"-A",
|
||||
"bare_trait_objects",
|
||||
"-A",
|
||||
"deprecated",
|
||||
"-A",
|
||||
"non_camel_case_types",
|
||||
"-A",
|
||||
"unused_imports",
|
||||
]
|
||||
# Suppress all warnings in third party, as Cargo does:
|
||||
# https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints
|
||||
rustflags = [ "--cap-lints=allow" ]
|
||||
|
||||
configs = [ ":default_warnings" ]
|
||||
}
|
||||
|
@ -2026,18 +2013,7 @@ if (is_win) {
|
|||
}
|
||||
|
||||
common_optimize_on_cflags += [
|
||||
"-mllvm", "-extra-vectorizer-passes",
|
||||
"-mllvm", "-enable-cond-stores-vec",
|
||||
"-mllvm", "-slp-vectorize-hor-store",
|
||||
"-mllvm", "-enable-loopinterchange",
|
||||
"-mllvm", "-enable-loop-distribute",
|
||||
"-mllvm", "-enable-unroll-and-jam",
|
||||
"-mllvm", "-enable-loop-flatten",
|
||||
"-mllvm", "-interleave-small-loop-scalar-reduction",
|
||||
"-mllvm", "-unroll-runtime-multi-exit",
|
||||
"-mllvm", "-aggressive-ext-opt",
|
||||
"-mllvm", "-enable-interleaved-mem-accesses",
|
||||
"/O3",
|
||||
"/O2",
|
||||
"/clang:-O3",
|
||||
"/clang:-mavx",
|
||||
"/clang:-mavx2",
|
||||
|
@ -2048,17 +2024,6 @@ if (is_win) {
|
|||
]
|
||||
|
||||
common_optimize_on_ldflags += [
|
||||
"-mllvm:-extra-vectorizer-passes",
|
||||
"-mllvm:-enable-cond-stores-vec",
|
||||
"-mllvm:-slp-vectorize-hor-store",
|
||||
"-mllvm:-enable-loopinterchange",
|
||||
"-mllvm:-enable-loop-distribute",
|
||||
"-mllvm:-enable-unroll-and-jam",
|
||||
"-mllvm:-enable-loop-flatten",
|
||||
"-mllvm:-interleave-small-loop-scalar-reduction",
|
||||
"-mllvm:-unroll-runtime-multi-exit",
|
||||
"-mllvm:-aggressive-ext-opt",
|
||||
"-mllvm:-enable-interleaved-mem-accesses",
|
||||
]
|
||||
|
||||
# /OPT:ICF is not desirable in Debug builds, since code-folding can result in
|
||||
|
@ -2187,10 +2152,16 @@ config("optimize") {
|
|||
# Favor size over speed, /O1 must be before the common flags.
|
||||
# /O1 implies /Os and /GF.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else {
|
||||
# PGO requires all translation units to be compiled with /O2. The actual
|
||||
# optimization level will be decided based on the profiling data.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
|
||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||
# to optimize for performance like `/O2` for clang.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
}
|
||||
} else if (optimize_for_size) {
|
||||
# Favor size over speed.
|
||||
|
@ -2206,6 +2177,10 @@ config("optimize") {
|
|||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
}
|
||||
|
||||
# Like with `-Oz` on Clang, `-Copt-level=z` will also turn off loop
|
||||
# vectorization.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else if (is_chromeos) {
|
||||
# TODO(gbiv): This is partially favoring size over speed. CrOS exclusively
|
||||
# uses clang, and -Os in clang is more of a size-conscious -O2 than "size at
|
||||
|
@ -2214,13 +2189,17 @@ config("optimize") {
|
|||
# for size by default (so, also Windows)
|
||||
# - Investigate -Oz here, maybe just for ARM?
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
|
||||
# Similar to clang, we optimize with `-Copt-level=s` to keep loop
|
||||
# vectorization while otherwise optimizing for size.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
}
|
||||
if (optimize_for_size) {
|
||||
rustflags = [ "-Copt-level=3", "-Ctarget-feature=+aes,+avx,+avx2,-pclmul", ]
|
||||
} else {
|
||||
rustflags = [ "-Copt-level=3", "-Ctarget-feature=+aes,+avx,+avx2,-pclmul", ]
|
||||
|
||||
# The `-O3` for clang turns on extra optimizations compared to the standard
|
||||
# `-O2`. But for rust, `-Copt-level=3` is the default and is thus reliable
|
||||
# to use.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
}
|
||||
ldflags = common_optimize_on_ldflags
|
||||
}
|
||||
|
@ -2448,7 +2427,14 @@ config("win_pdbaltpath") {
|
|||
config("symbols") {
|
||||
if (is_win) {
|
||||
if (is_clang) {
|
||||
cflags = [ "/Z7" ] # Debug information in the .obj files.
|
||||
cflags = [
|
||||
# Debug information in the .obj files.
|
||||
"/Z7",
|
||||
|
||||
# Disable putting the compiler command line into the debug info to
|
||||
# prevent some types of non-determinism.
|
||||
"-gno-codeview-command-line",
|
||||
]
|
||||
} else {
|
||||
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
|
||||
}
|
||||
|
@ -2731,7 +2717,16 @@ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
|
|||
config("default_init_stack_vars") {
|
||||
cflags = []
|
||||
if (init_stack_vars && is_clang && !is_nacl && !using_sanitizer) {
|
||||
cflags += [ "-ftrivial-auto-var-init=pattern" ]
|
||||
if (is_chromeos && !chromeos_is_browser_only) {
|
||||
# TODO(adriandole) remove chromeos_is_browser_only condition
|
||||
# once lacros updates toolchain
|
||||
|
||||
# Zero init has favorable performance/size tradeoffs for Chrome OS
|
||||
# but was not evaluated for other platforms.
|
||||
cflags += [ "-ftrivial-auto-var-init=zero" ]
|
||||
} else {
|
||||
cflags += [ "-ftrivial-auto-var-init=pattern" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -112,16 +112,16 @@ config("compiler") {
|
|||
if (host_cpu == "x86" || host_cpu == "x64") {
|
||||
cflags += [ "-m32" ]
|
||||
} else {
|
||||
cflags += [ "--target=i386-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=i386-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
} else if (current_cpu == "x64") {
|
||||
if (host_cpu == "x86" || host_cpu == "x64") {
|
||||
cflags += [ "-m64" ]
|
||||
} else {
|
||||
cflags += [ "--target=x86_64-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=x86_64-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
} else if (current_cpu == "arm64") {
|
||||
cflags += [ "--target=arm64-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=arm64-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
} else {
|
||||
assert(false, "unknown current_cpu " + current_cpu)
|
||||
}
|
||||
|
@ -132,12 +132,14 @@ config("compiler") {
|
|||
# "/fp:fast", enables FMA.
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
cflags += [
|
||||
"/O3",
|
||||
"/O2",
|
||||
"-mavx",
|
||||
"-mavx2",
|
||||
"-maes",
|
||||
"-mvaes",
|
||||
"-mpclmul",
|
||||
"/clang:-O3",
|
||||
"/clang:-mavx",
|
||||
"/clang:-mavx2",
|
||||
"/clang:-maes",
|
||||
"/clang:-mvaes",
|
||||
|
|
|
@ -67,7 +67,7 @@ enable_media_overlay = true
|
|||
enable_hangout_services_extension = true
|
||||
rtc_use_h264 = true
|
||||
rtc_include_ilbc = true
|
||||
rtc_build_with_neon = true
|
||||
rtc_build_with_neon = false
|
||||
rtc_build_examples = false
|
||||
# rtc_enable_avx2 = true
|
||||
enable_vr = true
|
||||
|
|
|
@ -133,9 +133,9 @@ declare_args() {
|
|||
# recognizable in the debugger, and crashes on memory accesses through
|
||||
# uninitialized pointers.
|
||||
#
|
||||
# TODO(crbug.com/1131993): Enabling this when 'is_android' is true breaks
|
||||
# content_shell_test_apk on both ARM and x86.
|
||||
init_stack_vars = !is_android
|
||||
# TODO(crbug.com/1131993): This regresses binary size by ~1MB on Android and
|
||||
# needs to be evaluated before enabling it there as well.
|
||||
init_stack_vars = !(is_android && is_official_build)
|
||||
|
||||
# This argument is to control whether enabling text section splitting in the
|
||||
# final binary. When enabled, the separated text sections with prefix
|
||||
|
@ -642,6 +642,11 @@ config("compiler") {
|
|||
cflags_cc += [ "-Wno-trigraphs" ]
|
||||
}
|
||||
|
||||
if (use_relative_vtables_abi) {
|
||||
cflags_cc += [ "-fexperimental-relative-c++-abi-vtables" ]
|
||||
ldflags += [ "-fexperimental-relative-c++-abi-vtables" ]
|
||||
}
|
||||
|
||||
# Add flags for link-time optimization. These flags enable
|
||||
# optimizations/transformations that require whole-program visibility at link
|
||||
# time, so they need to be applied to all translation units, and we may end up
|
||||
|
@ -857,6 +862,10 @@ config("compiler") {
|
|||
# we discover a reason to turn them off.
|
||||
"-Coverflow-checks=on",
|
||||
|
||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||
# The equivalent of -Werror for clang/gcc.
|
||||
"-Dwarnings",
|
||||
|
||||
# To make Rust .d files compatible with ninja
|
||||
"-Zdep-info-omit-d-target",
|
||||
|
||||
|
@ -945,6 +954,12 @@ config("compiler_cpu_abi") {
|
|||
configs += [ "//build/config/chromeos:compiler_cpu_abi" ]
|
||||
}
|
||||
|
||||
# TODO(https://crbug.com/1383873): Remove this once figured out.
|
||||
if (is_apple && current_cpu == "arm64") {
|
||||
cflags += [ "-fno-global-isel" ]
|
||||
ldflags += [ "-fno-global-isel" ]
|
||||
}
|
||||
|
||||
if ((is_posix && !is_apple) || is_fuchsia) {
|
||||
# CPU architecture. We may or may not be doing a cross compile now, so for
|
||||
# simplicity we always explicitly set the architecture.
|
||||
|
@ -1807,37 +1822,9 @@ config("no_chromium_code") {
|
|||
}
|
||||
}
|
||||
|
||||
# Rust warnings to ignore in third party dependencies. This list is
|
||||
# built from those warnings which are currently in our various Rust
|
||||
# third party dependencies, but aren't serious (they're largely
|
||||
# stylistic).
|
||||
# An alternative policy would be to suppress all warnings in third
|
||||
# party Rust code using "--cap-lints allow". This is what cargo does
|
||||
# for code outside your own crate, so is worth considering if it
|
||||
# turns out that maintaining this list is onerous.
|
||||
# (https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints)
|
||||
rustflags = [
|
||||
"-A",
|
||||
"unused_parens",
|
||||
"-A",
|
||||
"bare_trait_objects",
|
||||
"-A",
|
||||
"non_fmt_panics",
|
||||
"-A",
|
||||
"redundant_semicolons",
|
||||
"-A",
|
||||
"unused_parens",
|
||||
"-A",
|
||||
"anonymous_parameters",
|
||||
"-A",
|
||||
"bare_trait_objects",
|
||||
"-A",
|
||||
"deprecated",
|
||||
"-A",
|
||||
"non_camel_case_types",
|
||||
"-A",
|
||||
"unused_imports",
|
||||
]
|
||||
# Suppress all warnings in third party, as Cargo does:
|
||||
# https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints
|
||||
rustflags = [ "--cap-lints=allow" ]
|
||||
|
||||
configs = [ ":default_warnings" ]
|
||||
}
|
||||
|
@ -2041,7 +2028,7 @@ if (is_win) {
|
|||
"-mllvm", "-unroll-runtime-multi-exit",
|
||||
"-mllvm", "-aggressive-ext-opt",
|
||||
"-mllvm", "-enable-interleaved-mem-accesses",
|
||||
"/O3",
|
||||
"/O2",
|
||||
"/clang:-O3",
|
||||
"/clang:-msse3",
|
||||
"-Xclang", "-O3",
|
||||
|
@ -2187,10 +2174,16 @@ config("optimize") {
|
|||
# Favor size over speed, /O1 must be before the common flags.
|
||||
# /O1 implies /Os and /GF.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else {
|
||||
# PGO requires all translation units to be compiled with /O2. The actual
|
||||
# optimization level will be decided based on the profiling data.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
|
||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||
# to optimize for performance like `/O2` for clang.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
}
|
||||
} else if (optimize_for_size) {
|
||||
# Favor size over speed.
|
||||
|
@ -2206,6 +2199,10 @@ config("optimize") {
|
|||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
}
|
||||
|
||||
# Like with `-Oz` on Clang, `-Copt-level=z` will also turn off loop
|
||||
# vectorization.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else if (is_chromeos) {
|
||||
# TODO(gbiv): This is partially favoring size over speed. CrOS exclusively
|
||||
# uses clang, and -Os in clang is more of a size-conscious -O2 than "size at
|
||||
|
@ -2214,13 +2211,17 @@ config("optimize") {
|
|||
# for size by default (so, also Windows)
|
||||
# - Investigate -Oz here, maybe just for ARM?
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
|
||||
# Similar to clang, we optimize with `-Copt-level=s` to keep loop
|
||||
# vectorization while otherwise optimizing for size.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
}
|
||||
if (optimize_for_size) {
|
||||
rustflags = [ "-Copt-level=3", "-Ctarget-feature=+sse3", ]
|
||||
} else {
|
||||
rustflags = [ "-Copt-level=3", "-Ctarget-feature=+sse3", ]
|
||||
|
||||
# The `-O3` for clang turns on extra optimizations compared to the standard
|
||||
# `-O2`. But for rust, `-Copt-level=3` is the default and is thus reliable
|
||||
# to use.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
}
|
||||
ldflags = common_optimize_on_ldflags
|
||||
}
|
||||
|
@ -2448,7 +2449,14 @@ config("win_pdbaltpath") {
|
|||
config("symbols") {
|
||||
if (is_win) {
|
||||
if (is_clang) {
|
||||
cflags = [ "/Z7" ] # Debug information in the .obj files.
|
||||
cflags = [
|
||||
# Debug information in the .obj files.
|
||||
"/Z7",
|
||||
|
||||
# Disable putting the compiler command line into the debug info to
|
||||
# prevent some types of non-determinism.
|
||||
"-gno-codeview-command-line",
|
||||
]
|
||||
} else {
|
||||
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
|
||||
}
|
||||
|
@ -2731,7 +2739,16 @@ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
|
|||
config("default_init_stack_vars") {
|
||||
cflags = []
|
||||
if (init_stack_vars && is_clang && !is_nacl && !using_sanitizer) {
|
||||
cflags += [ "-ftrivial-auto-var-init=pattern" ]
|
||||
if (is_chromeos && !chromeos_is_browser_only) {
|
||||
# TODO(adriandole) remove chromeos_is_browser_only condition
|
||||
# once lacros updates toolchain
|
||||
|
||||
# Zero init has favorable performance/size tradeoffs for Chrome OS
|
||||
# but was not evaluated for other platforms.
|
||||
cflags += [ "-ftrivial-auto-var-init=zero" ]
|
||||
} else {
|
||||
cflags += [ "-ftrivial-auto-var-init=pattern" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -112,16 +112,16 @@ config("compiler") {
|
|||
if (host_cpu == "x86" || host_cpu == "x64") {
|
||||
cflags += [ "-m32" ]
|
||||
} else {
|
||||
cflags += [ "--target=i386-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=i386-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
} else if (current_cpu == "x64") {
|
||||
if (host_cpu == "x86" || host_cpu == "x64") {
|
||||
cflags += [ "-m64" ]
|
||||
} else {
|
||||
cflags += [ "--target=x86_64-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=x86_64-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
} else if (current_cpu == "arm64") {
|
||||
cflags += [ "--target=arm64-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=arm64-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
} else {
|
||||
assert(false, "unknown current_cpu " + current_cpu)
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ config("compiler") {
|
|||
# "/fp:fast", enables FMA.
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
cflags += [
|
||||
"/O3",
|
||||
"/O2",
|
||||
"-msse3",
|
||||
"/clang:-O3",
|
||||
"/clang:-msse3",
|
||||
|
|
|
@ -133,9 +133,9 @@ declare_args() {
|
|||
# recognizable in the debugger, and crashes on memory accesses through
|
||||
# uninitialized pointers.
|
||||
#
|
||||
# TODO(crbug.com/1131993): Enabling this when 'is_android' is true breaks
|
||||
# content_shell_test_apk on both ARM and x86.
|
||||
init_stack_vars = !is_android
|
||||
# TODO(crbug.com/1131993): This regresses binary size by ~1MB on Android and
|
||||
# needs to be evaluated before enabling it there as well.
|
||||
init_stack_vars = !(is_android && is_official_build)
|
||||
|
||||
# This argument is to control whether enabling text section splitting in the
|
||||
# final binary. When enabled, the separated text sections with prefix
|
||||
|
@ -635,6 +635,11 @@ config("compiler") {
|
|||
cflags_cc += [ "-Wno-trigraphs" ]
|
||||
}
|
||||
|
||||
if (use_relative_vtables_abi) {
|
||||
cflags_cc += [ "-fexperimental-relative-c++-abi-vtables" ]
|
||||
ldflags += [ "-fexperimental-relative-c++-abi-vtables" ]
|
||||
}
|
||||
|
||||
# Add flags for link-time optimization. These flags enable
|
||||
# optimizations/transformations that require whole-program visibility at link
|
||||
# time, so they need to be applied to all translation units, and we may end up
|
||||
|
@ -850,6 +855,10 @@ config("compiler") {
|
|||
# we discover a reason to turn them off.
|
||||
"-Coverflow-checks=on",
|
||||
|
||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||
# The equivalent of -Werror for clang/gcc.
|
||||
"-Dwarnings",
|
||||
|
||||
# To make Rust .d files compatible with ninja
|
||||
"-Zdep-info-omit-d-target",
|
||||
|
||||
|
@ -938,6 +947,12 @@ config("compiler_cpu_abi") {
|
|||
configs += [ "//build/config/chromeos:compiler_cpu_abi" ]
|
||||
}
|
||||
|
||||
# TODO(https://crbug.com/1383873): Remove this once figured out.
|
||||
if (is_apple && current_cpu == "arm64") {
|
||||
cflags += [ "-fno-global-isel" ]
|
||||
ldflags += [ "-fno-global-isel" ]
|
||||
}
|
||||
|
||||
if ((is_posix && !is_apple) || is_fuchsia) {
|
||||
# CPU architecture. We may or may not be doing a cross compile now, so for
|
||||
# simplicity we always explicitly set the architecture.
|
||||
|
@ -1803,37 +1818,9 @@ config("no_chromium_code") {
|
|||
}
|
||||
}
|
||||
|
||||
# Rust warnings to ignore in third party dependencies. This list is
|
||||
# built from those warnings which are currently in our various Rust
|
||||
# third party dependencies, but aren't serious (they're largely
|
||||
# stylistic).
|
||||
# An alternative policy would be to suppress all warnings in third
|
||||
# party Rust code using "--cap-lints allow". This is what cargo does
|
||||
# for code outside your own crate, so is worth considering if it
|
||||
# turns out that maintaining this list is onerous.
|
||||
# (https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints)
|
||||
rustflags = [
|
||||
"-A",
|
||||
"unused_parens",
|
||||
"-A",
|
||||
"bare_trait_objects",
|
||||
"-A",
|
||||
"non_fmt_panics",
|
||||
"-A",
|
||||
"redundant_semicolons",
|
||||
"-A",
|
||||
"unused_parens",
|
||||
"-A",
|
||||
"anonymous_parameters",
|
||||
"-A",
|
||||
"bare_trait_objects",
|
||||
"-A",
|
||||
"deprecated",
|
||||
"-A",
|
||||
"non_camel_case_types",
|
||||
"-A",
|
||||
"unused_imports",
|
||||
]
|
||||
# Suppress all warnings in third party, as Cargo does:
|
||||
# https://doc.rust-lang.org/rustc/lints/levels.html#capping-lints
|
||||
rustflags = [ "--cap-lints=allow" ]
|
||||
|
||||
configs = [ ":default_warnings" ]
|
||||
}
|
||||
|
@ -2037,7 +2024,7 @@ if (is_win) {
|
|||
"-mllvm", "-unroll-runtime-multi-exit",
|
||||
"-mllvm", "-aggressive-ext-opt",
|
||||
"-mllvm", "-enable-interleaved-mem-accesses",
|
||||
"/O3",
|
||||
"/O2",
|
||||
"/clang:-O3",
|
||||
"/clang:-mavx",
|
||||
"/clang:-maes",
|
||||
|
@ -2186,10 +2173,16 @@ config("optimize") {
|
|||
# Favor size over speed, /O1 must be before the common flags.
|
||||
# /O1 implies /Os and /GF.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else {
|
||||
# PGO requires all translation units to be compiled with /O2. The actual
|
||||
# optimization level will be decided based on the profiling data.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
|
||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||
# to optimize for performance like `/O2` for clang.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
}
|
||||
} else if (optimize_for_size) {
|
||||
# Favor size over speed.
|
||||
|
@ -2205,6 +2198,10 @@ config("optimize") {
|
|||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
}
|
||||
|
||||
# Like with `-Oz` on Clang, `-Copt-level=z` will also turn off loop
|
||||
# vectorization.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else if (is_chromeos) {
|
||||
# TODO(gbiv): This is partially favoring size over speed. CrOS exclusively
|
||||
# uses clang, and -Os in clang is more of a size-conscious -O2 than "size at
|
||||
|
@ -2213,13 +2210,17 @@ config("optimize") {
|
|||
# for size by default (so, also Windows)
|
||||
# - Investigate -Oz here, maybe just for ARM?
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
|
||||
# Similar to clang, we optimize with `-Copt-level=s` to keep loop
|
||||
# vectorization while otherwise optimizing for size.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
}
|
||||
if (optimize_for_size) {
|
||||
rustflags = [ "-Copt-level=3", "-Ctarget-feature=+aes,+avx,-pclmul", ]
|
||||
} else {
|
||||
rustflags = [ "-Copt-level=3", "-Ctarget-feature=+aes,+avx,-pclmul", ]
|
||||
|
||||
# The `-O3` for clang turns on extra optimizations compared to the standard
|
||||
# `-O2`. But for rust, `-Copt-level=3` is the default and is thus reliable
|
||||
# to use.
|
||||
rustflags = [ "-Copt-level=3" ]
|
||||
}
|
||||
ldflags = common_optimize_on_ldflags
|
||||
}
|
||||
|
@ -2447,7 +2448,14 @@ config("win_pdbaltpath") {
|
|||
config("symbols") {
|
||||
if (is_win) {
|
||||
if (is_clang) {
|
||||
cflags = [ "/Z7" ] # Debug information in the .obj files.
|
||||
cflags = [
|
||||
# Debug information in the .obj files.
|
||||
"/Z7",
|
||||
|
||||
# Disable putting the compiler command line into the debug info to
|
||||
# prevent some types of non-determinism.
|
||||
"-gno-codeview-command-line",
|
||||
]
|
||||
} else {
|
||||
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
|
||||
}
|
||||
|
@ -2730,7 +2738,16 @@ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
|
|||
config("default_init_stack_vars") {
|
||||
cflags = []
|
||||
if (init_stack_vars && is_clang && !is_nacl && !using_sanitizer) {
|
||||
cflags += [ "-ftrivial-auto-var-init=pattern" ]
|
||||
if (is_chromeos && !chromeos_is_browser_only) {
|
||||
# TODO(adriandole) remove chromeos_is_browser_only condition
|
||||
# once lacros updates toolchain
|
||||
|
||||
# Zero init has favorable performance/size tradeoffs for Chrome OS
|
||||
# but was not evaluated for other platforms.
|
||||
cflags += [ "-ftrivial-auto-var-init=zero" ]
|
||||
} else {
|
||||
cflags += [ "-ftrivial-auto-var-init=pattern" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
|
|
@ -112,16 +112,16 @@ config("compiler") {
|
|||
if (host_cpu == "x86" || host_cpu == "x64") {
|
||||
cflags += [ "-m32" ]
|
||||
} else {
|
||||
cflags += [ "--target=i386-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=i386-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
} else if (current_cpu == "x64") {
|
||||
if (host_cpu == "x86" || host_cpu == "x64") {
|
||||
cflags += [ "-m64" ]
|
||||
} else {
|
||||
cflags += [ "--target=x86_64-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=x86_64-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
} else if (current_cpu == "arm64") {
|
||||
cflags += [ "--target=arm64-windows", "/O3", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
cflags += [ "--target=arm64-windows", "/clang:-O3", "-Xclang", "-O3", "-Wno-unused-command-line-argument", ]
|
||||
} else {
|
||||
assert(false, "unknown current_cpu " + current_cpu)
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ config("compiler") {
|
|||
# "/fp:fast", enables FMA.
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
cflags += [
|
||||
"/O3",
|
||||
"/O2",
|
||||
"-mavx",
|
||||
"-maes",
|
||||
"-mvaes",
|
||||
|
|
Loading…
Reference in a new issue