mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-10 03:47:44 -03:00
Update BUILD.gn
This commit is contained in:
parent
7d4bab0d66
commit
323958cd47
1 changed files with 61 additions and 25 deletions
|
@ -106,7 +106,8 @@ declare_args() {
|
||||||
chromeos_afdo_platform = "atom"
|
chromeos_afdo_platform = "atom"
|
||||||
|
|
||||||
# Emit debug information for profiling wile building with clang.
|
# Emit debug information for profiling wile building with clang.
|
||||||
clang_emit_debug_info_for_profiling = false
|
# Only enable this for ChromeOS official builds for AFDO.
|
||||||
|
clang_emit_debug_info_for_profiling = is_chromeos_device && is_official_build
|
||||||
|
|
||||||
# Turn this on to have the compiler output extra timing information.
|
# Turn this on to have the compiler output extra timing information.
|
||||||
compiler_timing = false
|
compiler_timing = false
|
||||||
|
@ -163,6 +164,10 @@ declare_args() {
|
||||||
# Enable -H, which prints the include tree during compilation.
|
# Enable -H, which prints the include tree during compilation.
|
||||||
# For use by tools/clang/scripts/analyze_includes.py
|
# For use by tools/clang/scripts/analyze_includes.py
|
||||||
show_includes = false
|
show_includes = false
|
||||||
|
|
||||||
|
# If true, linker crashes will be rerun with `--reproduce` which causes
|
||||||
|
# a reproducer file to be saved.
|
||||||
|
save_reproducers_on_lld_crash = false
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_args() {
|
declare_args() {
|
||||||
|
@ -526,6 +531,12 @@ config("compiler") {
|
||||||
|
|
||||||
if (is_clang && !is_nacl && current_os != "zos") {
|
if (is_clang && !is_nacl && current_os != "zos") {
|
||||||
cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
|
cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
|
||||||
|
if (save_reproducers_on_lld_crash && use_lld) {
|
||||||
|
ldflags += [
|
||||||
|
"-fcrash-diagnostics=all",
|
||||||
|
"-fcrash-diagnostics-dir=" + clang_diagnostic_dir,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
# TODO(hans): Remove this once Clang generates better optimized debug info
|
# TODO(hans): Remove this once Clang generates better optimized debug info
|
||||||
# by default. https://crbug.com/765793
|
# by default. https://crbug.com/765793
|
||||||
|
@ -597,21 +608,25 @@ config("compiler") {
|
||||||
if (is_clang) {
|
if (is_clang) {
|
||||||
cflags_cc += [ "-fno-trigraphs" ]
|
cflags_cc += [ "-fno-trigraphs" ]
|
||||||
}
|
}
|
||||||
} else if (is_linux) {
|
} else if (is_clang) {
|
||||||
# TODO(crbug.com/1284275): Switch to C++20 on all platforms.
|
if (is_chromeos_device) {
|
||||||
if (is_clang) {
|
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
|
||||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||||
} else {
|
} else {
|
||||||
# The gcc bots are currently using GCC 9, which is not new enough to
|
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||||
# support "c++20"/"gnu++20".
|
|
||||||
cflags_cc += [ "-std=${standard_prefix}++2a" ]
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
# The gcc bots are currently using GCC 9, which is not new enough to
|
||||||
|
# support "c++20"/"gnu++20".
|
||||||
|
cflags_cc += [ "-std=${standard_prefix}++2a" ]
|
||||||
}
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags_c += [ "/std:c11" ]
|
cflags_c += [ "/std:c11" ]
|
||||||
cflags_cc += [ "/std:c++17" ]
|
if (!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17) {
|
||||||
|
cflags_cc += [ "/std:c++17" ]
|
||||||
|
} else {
|
||||||
|
cflags_cc += [ "/std:c++20" ]
|
||||||
|
}
|
||||||
} else if (!is_nacl) {
|
} else if (!is_nacl) {
|
||||||
# TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either
|
# TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either
|
||||||
# gnu11/gnu++11 or c11/c++11; we technically don't need this toolchain any
|
# gnu11/gnu++11 or c11/c++11; we technically don't need this toolchain any
|
||||||
|
@ -619,11 +634,13 @@ config("compiler") {
|
||||||
# turned off we need the !is_nacl clause and the (is_nacl && is_clang)
|
# turned off we need the !is_nacl clause and the (is_nacl && is_clang)
|
||||||
# clause, above.
|
# clause, above.
|
||||||
cflags_c += [ "-std=c11" ]
|
cflags_c += [ "-std=c11" ]
|
||||||
if (is_apple) {
|
|
||||||
# TODO(crbug.com/1284275): Switch to C++20 on all platforms.
|
if (is_fuchsia) {
|
||||||
cflags_cc += [ "-std=c++20" ]
|
# TODO(crbug.com/fuchsia/108751): The FIDL compiler generates code that
|
||||||
} else {
|
# 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 {
|
||||||
|
cflags_cc += [ "-std=c++20" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,10 +699,14 @@ config("compiler") {
|
||||||
# of "all" which means number of hardware threads) is faster.
|
# of "all" which means number of hardware threads) is faster.
|
||||||
ldflags += [ "-Wl,--thinlto-jobs=all" ]
|
ldflags += [ "-Wl,--thinlto-jobs=all" ]
|
||||||
if (is_apple) {
|
if (is_apple) {
|
||||||
|
_object_path_suffix = ""
|
||||||
|
if (is_ios) {
|
||||||
|
_object_path_suffix = ",persist"
|
||||||
|
}
|
||||||
ldflags += [
|
ldflags += [
|
||||||
"-Wl,-cache_path_lto," +
|
"-Wl,-cache_path_lto," +
|
||||||
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
||||||
"-Wcrl,object_path_lto",
|
"-Wcrl,object_path_lto" + _object_path_suffix,
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
ldflags +=
|
ldflags +=
|
||||||
|
@ -798,6 +819,17 @@ config("compiler") {
|
||||||
cflags += [ "-fcomplete-member-pointers" ]
|
cflags += [ "-fcomplete-member-pointers" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Use DWARF simple template names, with the following exceptions:
|
||||||
|
#
|
||||||
|
# * Windows is not supported as it doesn't use DWARF.
|
||||||
|
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
|
||||||
|
# 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.
|
||||||
|
if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
|
||||||
|
cflags_cc += [ "-gsimple-template-names" ]
|
||||||
|
}
|
||||||
|
|
||||||
# MLGO specific flags. These flags enable an ML-based inliner trained on
|
# MLGO specific flags. These flags enable an ML-based inliner trained on
|
||||||
# Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
|
# Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
|
||||||
# The "release" ML model is embedded into clang as part of its build.
|
# The "release" ML model is embedded into clang as part of its build.
|
||||||
|
@ -916,7 +948,7 @@ config("thinlto_optimize_max") {
|
||||||
# tweak code generation for a particular CPU do not belong here!
|
# tweak code generation for a particular CPU do not belong here!
|
||||||
# See "compiler_codegen", below.
|
# See "compiler_codegen", below.
|
||||||
config("compiler_cpu_abi") {
|
config("compiler_cpu_abi") {
|
||||||
cflags = []
|
cflags = [ "-O3", ]
|
||||||
ldflags = []
|
ldflags = []
|
||||||
defines = []
|
defines = []
|
||||||
|
|
||||||
|
@ -943,6 +975,11 @@ config("compiler_cpu_abi") {
|
||||||
"-msse3",
|
"-msse3",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
} else if (target_cpu == "arm64") {
|
||||||
|
if (!is_android && !is_nacl) {
|
||||||
|
cflags += [ "-O3", "-Wno-unused-command-line-argument", ]
|
||||||
|
ldflags += [ "-Wl,-O3", "-Wno-unused-command-line-argument", ]
|
||||||
|
}
|
||||||
} else if (current_cpu == "arm") {
|
} else if (current_cpu == "arm") {
|
||||||
if (is_clang && !is_android && !is_nacl &&
|
if (is_clang && !is_android && !is_nacl &&
|
||||||
!(is_chromeos_lacros && is_chromeos_device)) {
|
!(is_chromeos_lacros && is_chromeos_device)) {
|
||||||
|
@ -965,8 +1002,7 @@ config("compiler_cpu_abi") {
|
||||||
ldflags += [ "--target=aarch64-linux-gnu", "-Wl,-O3", "-Wno-unused-command-line-argument", ]
|
ldflags += [ "--target=aarch64-linux-gnu", "-Wl,-O3", "-Wno-unused-command-line-argument", ]
|
||||||
}
|
}
|
||||||
if (is_android) {
|
if (is_android) {
|
||||||
# Outline atomics crash on Exynos 9810. http://crbug.com/1272795
|
cflags += [ "-O3", ]
|
||||||
cflags += [ "-mno-outline-atomics", "-O3", ]
|
|
||||||
ldflags += [ "-Wl,-O3", ]
|
ldflags += [ "-Wl,-O3", ]
|
||||||
}
|
}
|
||||||
} else if (current_cpu == "mipsel" && !is_nacl) {
|
} else if (current_cpu == "mipsel" && !is_nacl) {
|
||||||
|
@ -2008,6 +2044,7 @@ if (is_win) {
|
||||||
if (is_official_build) {
|
if (is_official_build) {
|
||||||
common_optimize_on_ldflags += [ "/OPT:REF" ] # Remove unreferenced data.
|
common_optimize_on_ldflags += [ "/OPT:REF" ] # Remove unreferenced data.
|
||||||
# TODO(thakis): Add LTO/PGO clang flags eventually, https://crbug.com/598772
|
# TODO(thakis): Add LTO/PGO clang flags eventually, https://crbug.com/598772
|
||||||
|
common_optimize_on_cflags += []
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
common_optimize_on_cflags = []
|
common_optimize_on_cflags = []
|
||||||
|
@ -2382,7 +2419,8 @@ config("symbols") {
|
||||||
cflags += [ "-fno-standalone-debug" ]
|
cflags += [ "-fno-standalone-debug" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_nacl) {
|
# On aix -gdwarf causes linker failures due to thread_local variables.
|
||||||
|
if (!is_nacl && current_os != "aix") {
|
||||||
if (use_dwarf5) {
|
if (use_dwarf5) {
|
||||||
cflags += [ "-gdwarf-5" ]
|
cflags += [ "-gdwarf-5" ]
|
||||||
} else if (!is_apple) {
|
} else if (!is_apple) {
|
||||||
|
@ -2410,9 +2448,6 @@ config("symbols") {
|
||||||
# It is skipped in tsan and asan because enabling it causes some
|
# It is skipped in tsan and asan because enabling it causes some
|
||||||
# formatting changes in the output which would require fixing bunches
|
# formatting changes in the output which would require fixing bunches
|
||||||
# of expectation regexps.
|
# of expectation regexps.
|
||||||
#
|
|
||||||
# It is skipped when generating bitcode is enabled as -gdwars-aranges
|
|
||||||
# is incompatible with -fembed-bitcode/-fembed-bitcode-marker.
|
|
||||||
cflags += [ "-gdwarf-aranges" ]
|
cflags += [ "-gdwarf-aranges" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2515,7 +2550,8 @@ config("minimal_symbols") {
|
||||||
# at least 10.11.
|
# at least 10.11.
|
||||||
# TODO(thakis): Remove this once mac_deployment_target is 10.11.
|
# TODO(thakis): Remove this once mac_deployment_target is 10.11.
|
||||||
cflags += [ "-gdwarf-4" ]
|
cflags += [ "-gdwarf-4" ]
|
||||||
} else if (!use_dwarf5 && !is_nacl) {
|
} else if (!use_dwarf5 && !is_nacl && current_os != "aix") {
|
||||||
|
# On aix -gdwarf causes linker failures due to thread_local variables.
|
||||||
# Recent clang versions default to DWARF5 on Linux, and Android is about
|
# Recent clang versions default to DWARF5 on Linux, and Android is about
|
||||||
# to switch. TODO: Adopt that in controlled way.
|
# to switch. TODO: Adopt that in controlled way.
|
||||||
cflags += [ "-gdwarf-4" ]
|
cflags += [ "-gdwarf-4" ]
|
||||||
|
|
Loading…
Reference in a new issue