update main BUILD.gns
This commit is contained in:
parent
52ff9f7513
commit
0dfe6cd0b2
6 changed files with 209 additions and 132 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved.
|
# Copyright 2023 The Chromium Authors and Alex313031. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -172,6 +172,11 @@ declare_args() {
|
||||||
# For use by tools/clang/scripts/analyze_includes.py
|
# For use by tools/clang/scripts/analyze_includes.py
|
||||||
show_includes = false
|
show_includes = false
|
||||||
|
|
||||||
|
# Enable Profi algorithm. Profi can infer block and edge counts.
|
||||||
|
# https://clang.llvm.org/docs/UsersManual.html#using-sampling-profilers
|
||||||
|
# TODO(crbug.com/1375958i:) Possibly enable this for Android too.
|
||||||
|
use_profi = is_chromeos
|
||||||
|
|
||||||
# If true, linker crashes will be rerun with `--reproduce` which causes
|
# If true, linker crashes will be rerun with `--reproduce` which causes
|
||||||
# a reproducer file to be saved.
|
# a reproducer file to be saved.
|
||||||
save_reproducers_on_lld_crash = false
|
save_reproducers_on_lld_crash = false
|
||||||
|
@ -617,8 +622,7 @@ config("compiler") {
|
||||||
cflags_cc += [ "-fno-trigraphs" ]
|
cflags_cc += [ "-fno-trigraphs" ]
|
||||||
}
|
}
|
||||||
} else if (is_clang) {
|
} else if (is_clang) {
|
||||||
if (is_chromeos_device || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
|
|
||||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||||
|
@ -643,9 +647,7 @@ config("compiler") {
|
||||||
# clause, above.
|
# clause, above.
|
||||||
cflags_c += [ "-std=c11" ]
|
cflags_c += [ "-std=c11" ]
|
||||||
|
|
||||||
if (is_fuchsia || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/fuchsia/108751): The FIDL compiler generates code that
|
|
||||||
# will not compile in C++20 mode. Switch to C++20 when this is resolved.
|
|
||||||
cflags_cc += [ "-std=c++17" ]
|
cflags_cc += [ "-std=c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=c++20" ]
|
cflags_cc += [ "-std=c++20" ]
|
||||||
|
@ -841,9 +843,8 @@ config("compiler") {
|
||||||
# * Windows is not supported as it doesn't use DWARF.
|
# * Windows is not supported as it doesn't use DWARF.
|
||||||
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
||||||
# lldb doesn't have the needed changes yet.
|
# lldb doesn't have the needed changes yet.
|
||||||
# * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
|
|
||||||
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
||||||
if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
|
if (is_clang && !is_nacl && !is_win && !is_apple) {
|
||||||
cflags_cc += [ "-gsimple-template-names" ]
|
cflags_cc += [ "-gsimple-template-names" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,6 +892,13 @@ config("compiler") {
|
||||||
# we discover a reason to turn them off.
|
# we discover a reason to turn them off.
|
||||||
"-Coverflow-checks=on",
|
"-Coverflow-checks=on",
|
||||||
|
|
||||||
|
# By default Rust passes `-nodefaultlibs` to the linker, however this
|
||||||
|
# conflicts with our `--unwind=none` flag for Android dylibs, as the latter
|
||||||
|
# is then unused and produces a warning/error. So this removes the
|
||||||
|
# `-nodefaultlibs` from the linker invocation from Rust, which would be used
|
||||||
|
# to compile dylibs on Android, such as for constructing unit test APKs.
|
||||||
|
"-Cdefault-linker-libraries",
|
||||||
|
|
||||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||||
# The equivalent of -Werror for clang/gcc.
|
# The equivalent of -Werror for clang/gcc.
|
||||||
"-Dwarnings",
|
"-Dwarnings",
|
||||||
|
@ -1333,9 +1341,10 @@ config("compiler_codegen") {
|
||||||
configs += [ "//build/config/nacl:compiler_codegen" ]
|
configs += [ "//build/config/nacl:compiler_codegen" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_cpu == "arm64" && is_android) {
|
if (current_cpu == "arm64" && !is_win) {
|
||||||
# On arm64 disable outlining for Android. See crbug.com/931297 for more
|
# Disable outlining everywhere on arm64 except Win. For more information see
|
||||||
# information.
|
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
|
||||||
|
# TODO(crbug.com/1411363): Enable this on Windows if possible.
|
||||||
cflags += [ "-mno-outline" ]
|
cflags += [ "-mno-outline" ]
|
||||||
|
|
||||||
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
||||||
|
@ -1459,16 +1468,13 @@ config("clang_revision") {
|
||||||
}
|
}
|
||||||
|
|
||||||
config("rustc_revision") {
|
config("rustc_revision") {
|
||||||
if (enable_rust && defined(rustc_version)) {
|
if (rustc_revision != "") {
|
||||||
# Similar to the above config, this is here so that all files get
|
# Similar to the above config, this is here so that all files get recompiled
|
||||||
# recompiled after a rustc roll. Nothing should ever read this cfg.
|
# after a rustc roll. Nothing should ever read this cfg. This will not be
|
||||||
# $rustc_version is a gn arg set within //build/config/rust.gni
|
# set if a custom toolchain is used.
|
||||||
# so that users using a custom Rust toolchain can override it.
|
|
||||||
# Its accuracy is checked in //build/rust/std:find_stdlib, which
|
|
||||||
# most of our Rust targets depend upon.
|
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"--cfg",
|
"--cfg",
|
||||||
"rustc_version=\"$rustc_version\"",
|
"cr_rustc_revision=\"$rustc_revision\"",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1686,6 +1692,9 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
||||||
"-Wno-bitfield-constant-conversion",
|
"-Wno-bitfield-constant-conversion",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
|
"-Wno-deprecated-this-capture",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2072,7 +2081,6 @@ if (is_win) {
|
||||||
common_optimize_on_ldflags += [
|
common_optimize_on_ldflags += [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
if (use_polly == true) {
|
if (use_polly == true) {
|
||||||
common_optimize_on_ldflags += [
|
common_optimize_on_ldflags += [
|
||||||
"-mllvm:-polly",
|
"-mllvm:-polly",
|
||||||
|
@ -2194,12 +2202,12 @@ config("optimize") {
|
||||||
if (chrome_pgo_phase != 2) {
|
if (chrome_pgo_phase != 2) {
|
||||||
# Favor size over speed, /O1 must be before the common flags.
|
# Favor size over speed, /O1 must be before the common flags.
|
||||||
# /O1 implies /Os and /GF.
|
# /O1 implies /Os and /GF.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
rustflags = [ "-Copt-level=3" ]
|
rustflags = [ "-Copt-level=3" ]
|
||||||
} else {
|
} else {
|
||||||
# PGO requires all translation units to be compiled with /O2. The actual
|
# PGO requires all translation units to be compiled with /O2. The actual
|
||||||
# optimization level will be decided based on the profiling data.
|
# optimization level will be decided based on the profiling data.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
|
|
||||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||||
|
@ -2427,6 +2435,9 @@ config("afdo") {
|
||||||
rebased_clang_sample_profile =
|
rebased_clang_sample_profile =
|
||||||
rebase_path(_clang_sample_profile, root_build_dir)
|
rebase_path(_clang_sample_profile, root_build_dir)
|
||||||
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
||||||
|
if (use_profi) {
|
||||||
|
cflags += [ "-fsample-profile-use-profi" ]
|
||||||
|
}
|
||||||
inputs = [ _clang_sample_profile ]
|
inputs = [ _clang_sample_profile ]
|
||||||
}
|
}
|
||||||
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved.
|
# Copyright 2023 The Chromium Authors and Alex313031. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -172,6 +172,11 @@ declare_args() {
|
||||||
# For use by tools/clang/scripts/analyze_includes.py
|
# For use by tools/clang/scripts/analyze_includes.py
|
||||||
show_includes = false
|
show_includes = false
|
||||||
|
|
||||||
|
# Enable Profi algorithm. Profi can infer block and edge counts.
|
||||||
|
# https://clang.llvm.org/docs/UsersManual.html#using-sampling-profilers
|
||||||
|
# TODO(crbug.com/1375958i:) Possibly enable this for Android too.
|
||||||
|
use_profi = is_chromeos
|
||||||
|
|
||||||
# If true, linker crashes will be rerun with `--reproduce` which causes
|
# If true, linker crashes will be rerun with `--reproduce` which causes
|
||||||
# a reproducer file to be saved.
|
# a reproducer file to be saved.
|
||||||
save_reproducers_on_lld_crash = false
|
save_reproducers_on_lld_crash = false
|
||||||
|
@ -352,6 +357,11 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ADDED BY ALEX313031 FOR THORIUM
|
||||||
|
if (is_clang && is_android && !is_ubsan && !is_ubsan_security) {
|
||||||
|
cflags += [ "-fwrapv" ]
|
||||||
|
}
|
||||||
|
|
||||||
# Linker warnings.
|
# Linker warnings.
|
||||||
if (fatal_linker_warnings && !is_apple && current_os != "aix" &&
|
if (fatal_linker_warnings && !is_apple && current_os != "aix" &&
|
||||||
current_os != "zos") {
|
current_os != "zos") {
|
||||||
|
@ -612,8 +622,7 @@ config("compiler") {
|
||||||
cflags_cc += [ "-fno-trigraphs" ]
|
cflags_cc += [ "-fno-trigraphs" ]
|
||||||
}
|
}
|
||||||
} else if (is_clang) {
|
} else if (is_clang) {
|
||||||
if (is_chromeos_device || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
|
|
||||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||||
|
@ -638,9 +647,7 @@ config("compiler") {
|
||||||
# clause, above.
|
# clause, above.
|
||||||
cflags_c += [ "-std=c11" ]
|
cflags_c += [ "-std=c11" ]
|
||||||
|
|
||||||
if (is_fuchsia || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/fuchsia/108751): The FIDL compiler generates code that
|
|
||||||
# will not compile in C++20 mode. Switch to C++20 when this is resolved.
|
|
||||||
cflags_cc += [ "-std=c++17" ]
|
cflags_cc += [ "-std=c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=c++20" ]
|
cflags_cc += [ "-std=c++20" ]
|
||||||
|
@ -827,9 +834,8 @@ config("compiler") {
|
||||||
# * Windows is not supported as it doesn't use DWARF.
|
# * Windows is not supported as it doesn't use DWARF.
|
||||||
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
||||||
# lldb doesn't have the needed changes yet.
|
# lldb doesn't have the needed changes yet.
|
||||||
# * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
|
|
||||||
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
||||||
if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
|
if (is_clang && !is_nacl && !is_win && !is_apple) {
|
||||||
cflags_cc += [ "-gsimple-template-names" ]
|
cflags_cc += [ "-gsimple-template-names" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,6 +883,13 @@ config("compiler") {
|
||||||
# we discover a reason to turn them off.
|
# we discover a reason to turn them off.
|
||||||
"-Coverflow-checks=on",
|
"-Coverflow-checks=on",
|
||||||
|
|
||||||
|
# By default Rust passes `-nodefaultlibs` to the linker, however this
|
||||||
|
# conflicts with our `--unwind=none` flag for Android dylibs, as the latter
|
||||||
|
# is then unused and produces a warning/error. So this removes the
|
||||||
|
# `-nodefaultlibs` from the linker invocation from Rust, which would be used
|
||||||
|
# to compile dylibs on Android, such as for constructing unit test APKs.
|
||||||
|
"-Cdefault-linker-libraries",
|
||||||
|
|
||||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||||
# The equivalent of -Werror for clang/gcc.
|
# The equivalent of -Werror for clang/gcc.
|
||||||
"-Dwarnings",
|
"-Dwarnings",
|
||||||
|
@ -1301,9 +1314,10 @@ config("compiler_codegen") {
|
||||||
configs += [ "//build/config/nacl:compiler_codegen" ]
|
configs += [ "//build/config/nacl:compiler_codegen" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_cpu == "arm64" && is_android) {
|
if (current_cpu == "arm64" && !is_win) {
|
||||||
# On arm64 disable outlining for Android. See crbug.com/931297 for more
|
# Disable outlining everywhere on arm64 except Win. For more information see
|
||||||
# information.
|
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
|
||||||
|
# TODO(crbug.com/1411363): Enable this on Windows if possible.
|
||||||
cflags += [ "-mno-outline" ]
|
cflags += [ "-mno-outline" ]
|
||||||
|
|
||||||
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
||||||
|
@ -1427,16 +1441,13 @@ config("clang_revision") {
|
||||||
}
|
}
|
||||||
|
|
||||||
config("rustc_revision") {
|
config("rustc_revision") {
|
||||||
if (enable_rust && defined(rustc_version)) {
|
if (rustc_revision != "") {
|
||||||
# Similar to the above config, this is here so that all files get
|
# Similar to the above config, this is here so that all files get recompiled
|
||||||
# recompiled after a rustc roll. Nothing should ever read this cfg.
|
# after a rustc roll. Nothing should ever read this cfg. This will not be
|
||||||
# $rustc_version is a gn arg set within //build/config/rust.gni
|
# set if a custom toolchain is used.
|
||||||
# so that users using a custom Rust toolchain can override it.
|
|
||||||
# Its accuracy is checked in //build/rust/std:find_stdlib, which
|
|
||||||
# most of our Rust targets depend upon.
|
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"--cfg",
|
"--cfg",
|
||||||
"rustc_version=\"$rustc_version\"",
|
"cr_rustc_revision=\"$rustc_revision\"",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1654,6 +1665,9 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
||||||
"-Wno-bitfield-constant-conversion",
|
"-Wno-bitfield-constant-conversion",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
|
"-Wno-deprecated-this-capture",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2074,11 +2088,12 @@ if (is_win) {
|
||||||
# can be removed at link time with --gc-sections.
|
# can be removed at link time with --gc-sections.
|
||||||
"-fdata-sections",
|
"-fdata-sections",
|
||||||
"-ffunction-sections",
|
"-ffunction-sections",
|
||||||
|
"-funique-section-names",
|
||||||
]
|
]
|
||||||
if ((!is_nacl || is_nacl_saigo) && is_clang) {
|
if ((!is_nacl || is_nacl_saigo) && is_clang) {
|
||||||
# We don't care about unique section names, this makes object files a bit
|
# We don't care about unique section names, this makes object files a bit
|
||||||
# smaller.
|
# smaller.
|
||||||
common_optimize_on_cflags += [ "-fno-unique-section-names" ]
|
# common_optimize_on_cflags += [ "-fno-unique-section-names" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
common_optimize_on_ldflags += [
|
common_optimize_on_ldflags += [
|
||||||
|
@ -2133,7 +2148,7 @@ config("optimize") {
|
||||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||||
# to optimize for performance like `/O2` for clang.
|
# to optimize for performance like `/O2` for clang.
|
||||||
rustflags = []
|
rustflags = [ "-Copt-level=3" ]
|
||||||
}
|
}
|
||||||
} else if (optimize_for_size) {
|
} else if (optimize_for_size) {
|
||||||
# Favor size over speed.
|
# Favor size over speed.
|
||||||
|
@ -2278,7 +2293,7 @@ config("optimize_speed") {
|
||||||
|
|
||||||
config("optimize_fuzzing") {
|
config("optimize_fuzzing") {
|
||||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||||
rustflags = [ "-Copt-level=3" ]
|
rustflags = [ "-Copt-level=3", ]
|
||||||
ldflags = common_optimize_on_ldflags
|
ldflags = common_optimize_on_ldflags
|
||||||
visibility = [ ":default_optimization" ]
|
visibility = [ ":default_optimization" ]
|
||||||
}
|
}
|
||||||
|
@ -2356,6 +2371,9 @@ config("afdo") {
|
||||||
rebased_clang_sample_profile =
|
rebased_clang_sample_profile =
|
||||||
rebase_path(_clang_sample_profile, root_build_dir)
|
rebase_path(_clang_sample_profile, root_build_dir)
|
||||||
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
||||||
|
if (use_profi) {
|
||||||
|
cflags += [ "-fsample-profile-use-profi" ]
|
||||||
|
}
|
||||||
inputs = [ _clang_sample_profile ]
|
inputs = [ _clang_sample_profile ]
|
||||||
}
|
}
|
||||||
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved.
|
# Copyright 2023 The Chromium Authors and Alex313031. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -172,6 +172,11 @@ declare_args() {
|
||||||
# For use by tools/clang/scripts/analyze_includes.py
|
# For use by tools/clang/scripts/analyze_includes.py
|
||||||
show_includes = false
|
show_includes = false
|
||||||
|
|
||||||
|
# Enable Profi algorithm. Profi can infer block and edge counts.
|
||||||
|
# https://clang.llvm.org/docs/UsersManual.html#using-sampling-profilers
|
||||||
|
# TODO(crbug.com/1375958i:) Possibly enable this for Android too.
|
||||||
|
use_profi = is_chromeos
|
||||||
|
|
||||||
# If true, linker crashes will be rerun with `--reproduce` which causes
|
# If true, linker crashes will be rerun with `--reproduce` which causes
|
||||||
# a reproducer file to be saved.
|
# a reproducer file to be saved.
|
||||||
save_reproducers_on_lld_crash = false
|
save_reproducers_on_lld_crash = false
|
||||||
|
@ -617,8 +622,7 @@ config("compiler") {
|
||||||
cflags_cc += [ "-fno-trigraphs" ]
|
cflags_cc += [ "-fno-trigraphs" ]
|
||||||
}
|
}
|
||||||
} else if (is_clang) {
|
} else if (is_clang) {
|
||||||
if (is_chromeos_device || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
|
|
||||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||||
|
@ -643,9 +647,7 @@ config("compiler") {
|
||||||
# clause, above.
|
# clause, above.
|
||||||
cflags_c += [ "-std=c11" ]
|
cflags_c += [ "-std=c11" ]
|
||||||
|
|
||||||
if (is_fuchsia || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/fuchsia/108751): The FIDL compiler generates code that
|
|
||||||
# will not compile in C++20 mode. Switch to C++20 when this is resolved.
|
|
||||||
cflags_cc += [ "-std=c++17" ]
|
cflags_cc += [ "-std=c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=c++20" ]
|
cflags_cc += [ "-std=c++20" ]
|
||||||
|
@ -832,9 +834,8 @@ config("compiler") {
|
||||||
# * Windows is not supported as it doesn't use DWARF.
|
# * Windows is not supported as it doesn't use DWARF.
|
||||||
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
||||||
# lldb doesn't have the needed changes yet.
|
# lldb doesn't have the needed changes yet.
|
||||||
# * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
|
|
||||||
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
||||||
if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
|
if (is_clang && !is_nacl && !is_win && !is_apple) {
|
||||||
cflags_cc += [ "-gsimple-template-names" ]
|
cflags_cc += [ "-gsimple-template-names" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,6 +883,13 @@ config("compiler") {
|
||||||
# we discover a reason to turn them off.
|
# we discover a reason to turn them off.
|
||||||
"-Coverflow-checks=on",
|
"-Coverflow-checks=on",
|
||||||
|
|
||||||
|
# By default Rust passes `-nodefaultlibs` to the linker, however this
|
||||||
|
# conflicts with our `--unwind=none` flag for Android dylibs, as the latter
|
||||||
|
# is then unused and produces a warning/error. So this removes the
|
||||||
|
# `-nodefaultlibs` from the linker invocation from Rust, which would be used
|
||||||
|
# to compile dylibs on Android, such as for constructing unit test APKs.
|
||||||
|
"-Cdefault-linker-libraries",
|
||||||
|
|
||||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||||
# The equivalent of -Werror for clang/gcc.
|
# The equivalent of -Werror for clang/gcc.
|
||||||
"-Dwarnings",
|
"-Dwarnings",
|
||||||
|
@ -896,7 +904,7 @@ config("compiler") {
|
||||||
# For deterministic builds, keep the local machine's current working
|
# For deterministic builds, keep the local machine's current working
|
||||||
# directory from appearing in build outputs.
|
# directory from appearing in build outputs.
|
||||||
"-Zremap-cwd-prefix=.",
|
"-Zremap-cwd-prefix=.",
|
||||||
|
|
||||||
# Full RUSTC optimizations.
|
# Full RUSTC optimizations.
|
||||||
"-Copt-level=3", "-Ctarget-feature=+aes,+avx,+avx2,-pclmul",
|
"-Copt-level=3", "-Ctarget-feature=+aes,+avx,+avx2,-pclmul",
|
||||||
]
|
]
|
||||||
|
@ -1325,9 +1333,10 @@ config("compiler_codegen") {
|
||||||
configs += [ "//build/config/nacl:compiler_codegen" ]
|
configs += [ "//build/config/nacl:compiler_codegen" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_cpu == "arm64" && is_android) {
|
if (current_cpu == "arm64" && !is_win) {
|
||||||
# On arm64 disable outlining for Android. See crbug.com/931297 for more
|
# Disable outlining everywhere on arm64 except Win. For more information see
|
||||||
# information.
|
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
|
||||||
|
# TODO(crbug.com/1411363): Enable this on Windows if possible.
|
||||||
cflags += [ "-mno-outline" ]
|
cflags += [ "-mno-outline" ]
|
||||||
|
|
||||||
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
||||||
|
@ -1451,16 +1460,13 @@ config("clang_revision") {
|
||||||
}
|
}
|
||||||
|
|
||||||
config("rustc_revision") {
|
config("rustc_revision") {
|
||||||
if (enable_rust && defined(rustc_version)) {
|
if (rustc_revision != "") {
|
||||||
# Similar to the above config, this is here so that all files get
|
# Similar to the above config, this is here so that all files get recompiled
|
||||||
# recompiled after a rustc roll. Nothing should ever read this cfg.
|
# after a rustc roll. Nothing should ever read this cfg. This will not be
|
||||||
# $rustc_version is a gn arg set within //build/config/rust.gni
|
# set if a custom toolchain is used.
|
||||||
# so that users using a custom Rust toolchain can override it.
|
|
||||||
# Its accuracy is checked in //build/rust/std:find_stdlib, which
|
|
||||||
# most of our Rust targets depend upon.
|
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"--cfg",
|
"--cfg",
|
||||||
"rustc_version=\"$rustc_version\"",
|
"cr_rustc_revision=\"$rustc_revision\"",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1678,6 +1684,9 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
||||||
"-Wno-bitfield-constant-conversion",
|
"-Wno-bitfield-constant-conversion",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
|
"-Wno-deprecated-this-capture",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2261,12 +2270,12 @@ config("optimize") {
|
||||||
if (chrome_pgo_phase != 2) {
|
if (chrome_pgo_phase != 2) {
|
||||||
# Favor size over speed, /O1 must be before the common flags.
|
# Favor size over speed, /O1 must be before the common flags.
|
||||||
# /O1 implies /Os and /GF.
|
# /O1 implies /Os and /GF.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
rustflags = [ "-Copt-level=3" ]
|
rustflags = [ "-Copt-level=3" ]
|
||||||
} else {
|
} else {
|
||||||
# PGO requires all translation units to be compiled with /O2. The actual
|
# PGO requires all translation units to be compiled with /O2. The actual
|
||||||
# optimization level will be decided based on the profiling data.
|
# optimization level will be decided based on the profiling data.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
|
|
||||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||||
|
@ -2494,6 +2503,9 @@ config("afdo") {
|
||||||
rebased_clang_sample_profile =
|
rebased_clang_sample_profile =
|
||||||
rebase_path(_clang_sample_profile, root_build_dir)
|
rebase_path(_clang_sample_profile, root_build_dir)
|
||||||
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
||||||
|
if (use_profi) {
|
||||||
|
cflags += [ "-fsample-profile-use-profi" ]
|
||||||
|
}
|
||||||
inputs = [ _clang_sample_profile ]
|
inputs = [ _clang_sample_profile ]
|
||||||
}
|
}
|
||||||
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved.
|
# Copyright 2023 The Chromium Authors and Alex313031. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -172,6 +172,11 @@ declare_args() {
|
||||||
# For use by tools/clang/scripts/analyze_includes.py
|
# For use by tools/clang/scripts/analyze_includes.py
|
||||||
show_includes = false
|
show_includes = false
|
||||||
|
|
||||||
|
# Enable Profi algorithm. Profi can infer block and edge counts.
|
||||||
|
# https://clang.llvm.org/docs/UsersManual.html#using-sampling-profilers
|
||||||
|
# TODO(crbug.com/1375958i:) Possibly enable this for Android too.
|
||||||
|
use_profi = is_chromeos
|
||||||
|
|
||||||
# If true, linker crashes will be rerun with `--reproduce` which causes
|
# If true, linker crashes will be rerun with `--reproduce` which causes
|
||||||
# a reproducer file to be saved.
|
# a reproducer file to be saved.
|
||||||
save_reproducers_on_lld_crash = false
|
save_reproducers_on_lld_crash = false
|
||||||
|
@ -617,8 +622,7 @@ config("compiler") {
|
||||||
cflags_cc += [ "-fno-trigraphs" ]
|
cflags_cc += [ "-fno-trigraphs" ]
|
||||||
}
|
}
|
||||||
} else if (is_clang) {
|
} else if (is_clang) {
|
||||||
if (is_chromeos_device || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
|
|
||||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||||
|
@ -643,9 +647,7 @@ config("compiler") {
|
||||||
# clause, above.
|
# clause, above.
|
||||||
cflags_c += [ "-std=c11" ]
|
cflags_c += [ "-std=c11" ]
|
||||||
|
|
||||||
if (is_fuchsia || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/fuchsia/108751): The FIDL compiler generates code that
|
|
||||||
# will not compile in C++20 mode. Switch to C++20 when this is resolved.
|
|
||||||
cflags_cc += [ "-std=c++17" ]
|
cflags_cc += [ "-std=c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=c++20" ]
|
cflags_cc += [ "-std=c++20" ]
|
||||||
|
@ -832,9 +834,8 @@ config("compiler") {
|
||||||
# * Windows is not supported as it doesn't use DWARF.
|
# * Windows is not supported as it doesn't use DWARF.
|
||||||
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
||||||
# lldb doesn't have the needed changes yet.
|
# lldb doesn't have the needed changes yet.
|
||||||
# * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
|
|
||||||
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
||||||
if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
|
if (is_clang && !is_nacl && !is_win && !is_apple) {
|
||||||
cflags_cc += [ "-gsimple-template-names" ]
|
cflags_cc += [ "-gsimple-template-names" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,6 +883,13 @@ config("compiler") {
|
||||||
# we discover a reason to turn them off.
|
# we discover a reason to turn them off.
|
||||||
"-Coverflow-checks=on",
|
"-Coverflow-checks=on",
|
||||||
|
|
||||||
|
# By default Rust passes `-nodefaultlibs` to the linker, however this
|
||||||
|
# conflicts with our `--unwind=none` flag for Android dylibs, as the latter
|
||||||
|
# is then unused and produces a warning/error. So this removes the
|
||||||
|
# `-nodefaultlibs` from the linker invocation from Rust, which would be used
|
||||||
|
# to compile dylibs on Android, such as for constructing unit test APKs.
|
||||||
|
"-Cdefault-linker-libraries",
|
||||||
|
|
||||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||||
# The equivalent of -Werror for clang/gcc.
|
# The equivalent of -Werror for clang/gcc.
|
||||||
"-Dwarnings",
|
"-Dwarnings",
|
||||||
|
@ -896,7 +904,7 @@ config("compiler") {
|
||||||
# For deterministic builds, keep the local machine's current working
|
# For deterministic builds, keep the local machine's current working
|
||||||
# directory from appearing in build outputs.
|
# directory from appearing in build outputs.
|
||||||
"-Zremap-cwd-prefix=.",
|
"-Zremap-cwd-prefix=.",
|
||||||
|
|
||||||
# Full RUSTC optimizations.
|
# Full RUSTC optimizations.
|
||||||
"-Copt-level=3", "-Ctarget-feature=+sse2",
|
"-Copt-level=3", "-Ctarget-feature=+sse2",
|
||||||
]
|
]
|
||||||
|
@ -1322,9 +1330,10 @@ config("compiler_codegen") {
|
||||||
configs += [ "//build/config/nacl:compiler_codegen" ]
|
configs += [ "//build/config/nacl:compiler_codegen" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_cpu == "arm64" && is_android) {
|
if (current_cpu == "arm64" && !is_win) {
|
||||||
# On arm64 disable outlining for Android. See crbug.com/931297 for more
|
# Disable outlining everywhere on arm64 except Win. For more information see
|
||||||
# information.
|
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
|
||||||
|
# TODO(crbug.com/1411363): Enable this on Windows if possible.
|
||||||
cflags += [ "-mno-outline" ]
|
cflags += [ "-mno-outline" ]
|
||||||
|
|
||||||
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
||||||
|
@ -1448,16 +1457,13 @@ config("clang_revision") {
|
||||||
}
|
}
|
||||||
|
|
||||||
config("rustc_revision") {
|
config("rustc_revision") {
|
||||||
if (enable_rust && defined(rustc_version)) {
|
if (rustc_revision != "") {
|
||||||
# Similar to the above config, this is here so that all files get
|
# Similar to the above config, this is here so that all files get recompiled
|
||||||
# recompiled after a rustc roll. Nothing should ever read this cfg.
|
# after a rustc roll. Nothing should ever read this cfg. This will not be
|
||||||
# $rustc_version is a gn arg set within //build/config/rust.gni
|
# set if a custom toolchain is used.
|
||||||
# so that users using a custom Rust toolchain can override it.
|
|
||||||
# Its accuracy is checked in //build/rust/std:find_stdlib, which
|
|
||||||
# most of our Rust targets depend upon.
|
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"--cfg",
|
"--cfg",
|
||||||
"rustc_version=\"$rustc_version\"",
|
"cr_rustc_revision=\"$rustc_revision\"",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1675,6 +1681,9 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
||||||
"-Wno-bitfield-constant-conversion",
|
"-Wno-bitfield-constant-conversion",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
|
"-Wno-deprecated-this-capture",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2255,12 +2264,12 @@ config("optimize") {
|
||||||
if (chrome_pgo_phase != 2) {
|
if (chrome_pgo_phase != 2) {
|
||||||
# Favor size over speed, /O1 must be before the common flags.
|
# Favor size over speed, /O1 must be before the common flags.
|
||||||
# /O1 implies /Os and /GF.
|
# /O1 implies /Os and /GF.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
rustflags = [ "-Copt-level=3" ]
|
rustflags = [ "-Copt-level=3" ]
|
||||||
} else {
|
} else {
|
||||||
# PGO requires all translation units to be compiled with /O2. The actual
|
# PGO requires all translation units to be compiled with /O2. The actual
|
||||||
# optimization level will be decided based on the profiling data.
|
# optimization level will be decided based on the profiling data.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
|
|
||||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||||
|
@ -2488,6 +2497,9 @@ config("afdo") {
|
||||||
rebased_clang_sample_profile =
|
rebased_clang_sample_profile =
|
||||||
rebase_path(_clang_sample_profile, root_build_dir)
|
rebase_path(_clang_sample_profile, root_build_dir)
|
||||||
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
||||||
|
if (use_profi) {
|
||||||
|
cflags += [ "-fsample-profile-use-profi" ]
|
||||||
|
}
|
||||||
inputs = [ _clang_sample_profile ]
|
inputs = [ _clang_sample_profile ]
|
||||||
}
|
}
|
||||||
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved.
|
# Copyright 2023 The Chromium Authors and Alex313031. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -172,6 +172,11 @@ declare_args() {
|
||||||
# For use by tools/clang/scripts/analyze_includes.py
|
# For use by tools/clang/scripts/analyze_includes.py
|
||||||
show_includes = false
|
show_includes = false
|
||||||
|
|
||||||
|
# Enable Profi algorithm. Profi can infer block and edge counts.
|
||||||
|
# https://clang.llvm.org/docs/UsersManual.html#using-sampling-profilers
|
||||||
|
# TODO(crbug.com/1375958i:) Possibly enable this for Android too.
|
||||||
|
use_profi = is_chromeos
|
||||||
|
|
||||||
# If true, linker crashes will be rerun with `--reproduce` which causes
|
# If true, linker crashes will be rerun with `--reproduce` which causes
|
||||||
# a reproducer file to be saved.
|
# a reproducer file to be saved.
|
||||||
save_reproducers_on_lld_crash = false
|
save_reproducers_on_lld_crash = false
|
||||||
|
@ -617,8 +622,7 @@ config("compiler") {
|
||||||
cflags_cc += [ "-fno-trigraphs" ]
|
cflags_cc += [ "-fno-trigraphs" ]
|
||||||
}
|
}
|
||||||
} else if (is_clang) {
|
} else if (is_clang) {
|
||||||
if (is_chromeos_device || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
|
|
||||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||||
|
@ -643,9 +647,7 @@ config("compiler") {
|
||||||
# clause, above.
|
# clause, above.
|
||||||
cflags_c += [ "-std=c11" ]
|
cflags_c += [ "-std=c11" ]
|
||||||
|
|
||||||
if (is_fuchsia || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/fuchsia/108751): The FIDL compiler generates code that
|
|
||||||
# will not compile in C++20 mode. Switch to C++20 when this is resolved.
|
|
||||||
cflags_cc += [ "-std=c++17" ]
|
cflags_cc += [ "-std=c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=c++20" ]
|
cflags_cc += [ "-std=c++20" ]
|
||||||
|
@ -832,9 +834,8 @@ config("compiler") {
|
||||||
# * Windows is not supported as it doesn't use DWARF.
|
# * Windows is not supported as it doesn't use DWARF.
|
||||||
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
||||||
# lldb doesn't have the needed changes yet.
|
# lldb doesn't have the needed changes yet.
|
||||||
# * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
|
|
||||||
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
||||||
if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
|
if (is_clang && !is_nacl && !is_win && !is_apple) {
|
||||||
cflags_cc += [ "-gsimple-template-names" ]
|
cflags_cc += [ "-gsimple-template-names" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,6 +883,13 @@ config("compiler") {
|
||||||
# we discover a reason to turn them off.
|
# we discover a reason to turn them off.
|
||||||
"-Coverflow-checks=on",
|
"-Coverflow-checks=on",
|
||||||
|
|
||||||
|
# By default Rust passes `-nodefaultlibs` to the linker, however this
|
||||||
|
# conflicts with our `--unwind=none` flag for Android dylibs, as the latter
|
||||||
|
# is then unused and produces a warning/error. So this removes the
|
||||||
|
# `-nodefaultlibs` from the linker invocation from Rust, which would be used
|
||||||
|
# to compile dylibs on Android, such as for constructing unit test APKs.
|
||||||
|
"-Cdefault-linker-libraries",
|
||||||
|
|
||||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||||
# The equivalent of -Werror for clang/gcc.
|
# The equivalent of -Werror for clang/gcc.
|
||||||
"-Dwarnings",
|
"-Dwarnings",
|
||||||
|
@ -896,7 +904,7 @@ config("compiler") {
|
||||||
# For deterministic builds, keep the local machine's current working
|
# For deterministic builds, keep the local machine's current working
|
||||||
# directory from appearing in build outputs.
|
# directory from appearing in build outputs.
|
||||||
"-Zremap-cwd-prefix=.",
|
"-Zremap-cwd-prefix=.",
|
||||||
|
|
||||||
# Full RUSTC optimizations.
|
# Full RUSTC optimizations.
|
||||||
"-Copt-level=3", "-Ctarget-feature=+sse3",
|
"-Copt-level=3", "-Ctarget-feature=+sse3",
|
||||||
]
|
]
|
||||||
|
@ -1322,9 +1330,10 @@ config("compiler_codegen") {
|
||||||
configs += [ "//build/config/nacl:compiler_codegen" ]
|
configs += [ "//build/config/nacl:compiler_codegen" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_cpu == "arm64" && is_android) {
|
if (current_cpu == "arm64" && !is_win) {
|
||||||
# On arm64 disable outlining for Android. See crbug.com/931297 for more
|
# Disable outlining everywhere on arm64 except Win. For more information see
|
||||||
# information.
|
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
|
||||||
|
# TODO(crbug.com/1411363): Enable this on Windows if possible.
|
||||||
cflags += [ "-mno-outline" ]
|
cflags += [ "-mno-outline" ]
|
||||||
|
|
||||||
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
||||||
|
@ -1448,16 +1457,13 @@ config("clang_revision") {
|
||||||
}
|
}
|
||||||
|
|
||||||
config("rustc_revision") {
|
config("rustc_revision") {
|
||||||
if (enable_rust && defined(rustc_version)) {
|
if (rustc_revision != "") {
|
||||||
# Similar to the above config, this is here so that all files get
|
# Similar to the above config, this is here so that all files get recompiled
|
||||||
# recompiled after a rustc roll. Nothing should ever read this cfg.
|
# after a rustc roll. Nothing should ever read this cfg. This will not be
|
||||||
# $rustc_version is a gn arg set within //build/config/rust.gni
|
# set if a custom toolchain is used.
|
||||||
# so that users using a custom Rust toolchain can override it.
|
|
||||||
# Its accuracy is checked in //build/rust/std:find_stdlib, which
|
|
||||||
# most of our Rust targets depend upon.
|
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"--cfg",
|
"--cfg",
|
||||||
"rustc_version=\"$rustc_version\"",
|
"cr_rustc_revision=\"$rustc_revision\"",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1675,6 +1681,9 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
||||||
"-Wno-bitfield-constant-conversion",
|
"-Wno-bitfield-constant-conversion",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
|
"-Wno-deprecated-this-capture",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2255,12 +2264,12 @@ config("optimize") {
|
||||||
if (chrome_pgo_phase != 2) {
|
if (chrome_pgo_phase != 2) {
|
||||||
# Favor size over speed, /O1 must be before the common flags.
|
# Favor size over speed, /O1 must be before the common flags.
|
||||||
# /O1 implies /Os and /GF.
|
# /O1 implies /Os and /GF.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
rustflags = [ "-Copt-level=3" ]
|
rustflags = [ "-Copt-level=3" ]
|
||||||
} else {
|
} else {
|
||||||
# PGO requires all translation units to be compiled with /O2. The actual
|
# PGO requires all translation units to be compiled with /O2. The actual
|
||||||
# optimization level will be decided based on the profiling data.
|
# optimization level will be decided based on the profiling data.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
|
|
||||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||||
|
@ -2488,6 +2497,9 @@ config("afdo") {
|
||||||
rebased_clang_sample_profile =
|
rebased_clang_sample_profile =
|
||||||
rebase_path(_clang_sample_profile, root_build_dir)
|
rebase_path(_clang_sample_profile, root_build_dir)
|
||||||
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
||||||
|
if (use_profi) {
|
||||||
|
cflags += [ "-fsample-profile-use-profi" ]
|
||||||
|
}
|
||||||
inputs = [ _clang_sample_profile ]
|
inputs = [ _clang_sample_profile ]
|
||||||
}
|
}
|
||||||
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved.
|
# Copyright 2023 The Chromium Authors and Alex313031. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -172,6 +172,11 @@ declare_args() {
|
||||||
# For use by tools/clang/scripts/analyze_includes.py
|
# For use by tools/clang/scripts/analyze_includes.py
|
||||||
show_includes = false
|
show_includes = false
|
||||||
|
|
||||||
|
# Enable Profi algorithm. Profi can infer block and edge counts.
|
||||||
|
# https://clang.llvm.org/docs/UsersManual.html#using-sampling-profilers
|
||||||
|
# TODO(crbug.com/1375958i:) Possibly enable this for Android too.
|
||||||
|
use_profi = is_chromeos
|
||||||
|
|
||||||
# If true, linker crashes will be rerun with `--reproduce` which causes
|
# If true, linker crashes will be rerun with `--reproduce` which causes
|
||||||
# a reproducer file to be saved.
|
# a reproducer file to be saved.
|
||||||
save_reproducers_on_lld_crash = false
|
save_reproducers_on_lld_crash = false
|
||||||
|
@ -610,8 +615,7 @@ config("compiler") {
|
||||||
cflags_cc += [ "-fno-trigraphs" ]
|
cflags_cc += [ "-fno-trigraphs" ]
|
||||||
}
|
}
|
||||||
} else if (is_clang) {
|
} else if (is_clang) {
|
||||||
if (is_chromeos_device || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
|
|
||||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||||
|
@ -636,9 +640,7 @@ config("compiler") {
|
||||||
# clause, above.
|
# clause, above.
|
||||||
cflags_c += [ "-std=c11" ]
|
cflags_c += [ "-std=c11" ]
|
||||||
|
|
||||||
if (is_fuchsia || use_cxx17) {
|
if (use_cxx17) {
|
||||||
# TODO(crbug.com/fuchsia/108751): The FIDL compiler generates code that
|
|
||||||
# will not compile in C++20 mode. Switch to C++20 when this is resolved.
|
|
||||||
cflags_cc += [ "-std=c++17" ]
|
cflags_cc += [ "-std=c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=c++20" ]
|
cflags_cc += [ "-std=c++20" ]
|
||||||
|
@ -825,9 +827,8 @@ config("compiler") {
|
||||||
# * Windows is not supported as it doesn't use DWARF.
|
# * Windows is not supported as it doesn't use DWARF.
|
||||||
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
||||||
# lldb doesn't have the needed changes yet.
|
# lldb doesn't have the needed changes yet.
|
||||||
# * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
|
|
||||||
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
||||||
if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
|
if (is_clang && !is_nacl && !is_win && !is_apple) {
|
||||||
cflags_cc += [ "-gsimple-template-names" ]
|
cflags_cc += [ "-gsimple-template-names" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,6 +876,13 @@ config("compiler") {
|
||||||
# we discover a reason to turn them off.
|
# we discover a reason to turn them off.
|
||||||
"-Coverflow-checks=on",
|
"-Coverflow-checks=on",
|
||||||
|
|
||||||
|
# By default Rust passes `-nodefaultlibs` to the linker, however this
|
||||||
|
# conflicts with our `--unwind=none` flag for Android dylibs, as the latter
|
||||||
|
# is then unused and produces a warning/error. So this removes the
|
||||||
|
# `-nodefaultlibs` from the linker invocation from Rust, which would be used
|
||||||
|
# to compile dylibs on Android, such as for constructing unit test APKs.
|
||||||
|
"-Cdefault-linker-libraries",
|
||||||
|
|
||||||
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
# Turn warnings into the "deny" lint level, which produce compiler errors.
|
||||||
# The equivalent of -Werror for clang/gcc.
|
# The equivalent of -Werror for clang/gcc.
|
||||||
"-Dwarnings",
|
"-Dwarnings",
|
||||||
|
@ -889,7 +897,7 @@ config("compiler") {
|
||||||
# For deterministic builds, keep the local machine's current working
|
# For deterministic builds, keep the local machine's current working
|
||||||
# directory from appearing in build outputs.
|
# directory from appearing in build outputs.
|
||||||
"-Zremap-cwd-prefix=.",
|
"-Zremap-cwd-prefix=.",
|
||||||
|
|
||||||
# Full RUSTC optimizations.
|
# Full RUSTC optimizations.
|
||||||
"-Copt-level=3", "-Ctarget-feature=+aes,+avx,-pclmul",
|
"-Copt-level=3", "-Ctarget-feature=+aes,+avx,-pclmul",
|
||||||
]
|
]
|
||||||
|
@ -1317,9 +1325,10 @@ config("compiler_codegen") {
|
||||||
configs += [ "//build/config/nacl:compiler_codegen" ]
|
configs += [ "//build/config/nacl:compiler_codegen" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_cpu == "arm64" && is_android) {
|
if (current_cpu == "arm64" && !is_win) {
|
||||||
# On arm64 disable outlining for Android. See crbug.com/931297 for more
|
# Disable outlining everywhere on arm64 except Win. For more information see
|
||||||
# information.
|
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
|
||||||
|
# TODO(crbug.com/1411363): Enable this on Windows if possible.
|
||||||
cflags += [ "-mno-outline" ]
|
cflags += [ "-mno-outline" ]
|
||||||
|
|
||||||
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
|
||||||
|
@ -1443,16 +1452,13 @@ config("clang_revision") {
|
||||||
}
|
}
|
||||||
|
|
||||||
config("rustc_revision") {
|
config("rustc_revision") {
|
||||||
if (enable_rust && defined(rustc_version)) {
|
if (rustc_revision != "") {
|
||||||
# Similar to the above config, this is here so that all files get
|
# Similar to the above config, this is here so that all files get recompiled
|
||||||
# recompiled after a rustc roll. Nothing should ever read this cfg.
|
# after a rustc roll. Nothing should ever read this cfg. This will not be
|
||||||
# $rustc_version is a gn arg set within //build/config/rust.gni
|
# set if a custom toolchain is used.
|
||||||
# so that users using a custom Rust toolchain can override it.
|
|
||||||
# Its accuracy is checked in //build/rust/std:find_stdlib, which
|
|
||||||
# most of our Rust targets depend upon.
|
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"--cfg",
|
"--cfg",
|
||||||
"rustc_version=\"$rustc_version\"",
|
"cr_rustc_revision=\"$rustc_revision\"",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1670,6 +1676,9 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
# TODO(crbug.com/1352183) Evaluate and possibly enable.
|
||||||
"-Wno-bitfield-constant-conversion",
|
"-Wno-bitfield-constant-conversion",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
|
"-Wno-deprecated-this-capture",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2252,12 +2261,12 @@ config("optimize") {
|
||||||
if (chrome_pgo_phase != 2) {
|
if (chrome_pgo_phase != 2) {
|
||||||
# Favor size over speed, /O1 must be before the common flags.
|
# Favor size over speed, /O1 must be before the common flags.
|
||||||
# /O1 implies /Os and /GF.
|
# /O1 implies /Os and /GF.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
rustflags = [ "-Copt-level=3" ]
|
rustflags = [ "-Copt-level=3" ]
|
||||||
} else {
|
} else {
|
||||||
# PGO requires all translation units to be compiled with /O2. The actual
|
# PGO requires all translation units to be compiled with /O2. The actual
|
||||||
# optimization level will be decided based on the profiling data.
|
# optimization level will be decided based on the profiling data.
|
||||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
cflags = [ "/O2", "-Xclang", "-O3", ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||||
|
|
||||||
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
|
||||||
# suggests not using an explicit `-Copt-level` at all, and the default is
|
# suggests not using an explicit `-Copt-level` at all, and the default is
|
||||||
|
@ -2485,6 +2494,9 @@ config("afdo") {
|
||||||
rebased_clang_sample_profile =
|
rebased_clang_sample_profile =
|
||||||
rebase_path(_clang_sample_profile, root_build_dir)
|
rebase_path(_clang_sample_profile, root_build_dir)
|
||||||
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
||||||
|
if (use_profi) {
|
||||||
|
cflags += [ "-fsample-profile-use-profi" ]
|
||||||
|
}
|
||||||
inputs = [ _clang_sample_profile ]
|
inputs = [ _clang_sample_profile ]
|
||||||
}
|
}
|
||||||
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
} else if (auto_profile_path != "" && is_a_target_toolchain) {
|
||||||
|
|
Loading…
Reference in a new issue