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
d486bbedd4
commit
7d4bab0d66
1 changed files with 54 additions and 25 deletions
|
@ -106,7 +106,8 @@ declare_args() {
|
|||
chromeos_afdo_platform = "atom"
|
||||
|
||||
# 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.
|
||||
compiler_timing = false
|
||||
|
@ -163,6 +164,10 @@ declare_args() {
|
|||
# Enable -H, which prints the include tree during compilation.
|
||||
# For use by tools/clang/scripts/analyze_includes.py
|
||||
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() {
|
||||
|
@ -526,6 +531,12 @@ config("compiler") {
|
|||
|
||||
if (is_clang && !is_nacl && current_os != "zos") {
|
||||
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
|
||||
# by default. https://crbug.com/765793
|
||||
|
@ -590,21 +601,25 @@ config("compiler") {
|
|||
if (is_clang) {
|
||||
cflags_cc += [ "-fno-trigraphs" ]
|
||||
}
|
||||
} else if (is_linux) {
|
||||
# TODO(crbug.com/1284275): Switch to C++20 on all platforms.
|
||||
if (is_clang) {
|
||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||
} else if (is_clang) {
|
||||
if (is_chromeos_device) {
|
||||
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
|
||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||
} else {
|
||||
# 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" ]
|
||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||
}
|
||||
} 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) {
|
||||
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) {
|
||||
# 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
|
||||
|
@ -612,11 +627,13 @@ config("compiler") {
|
|||
# turned off we need the !is_nacl clause and the (is_nacl && is_clang)
|
||||
# clause, above.
|
||||
cflags_c += [ "-std=c11" ]
|
||||
if (is_apple) {
|
||||
# TODO(crbug.com/1284275): Switch to C++20 on all platforms.
|
||||
cflags_cc += [ "-std=c++20" ]
|
||||
} else {
|
||||
|
||||
if (is_fuchsia) {
|
||||
# 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" ]
|
||||
} else {
|
||||
cflags_cc += [ "-std=c++20" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -675,10 +692,14 @@ config("compiler") {
|
|||
# of "all" which means number of hardware threads) is faster.
|
||||
ldflags += [ "-Wl,--thinlto-jobs=all" ]
|
||||
if (is_apple) {
|
||||
_object_path_suffix = ""
|
||||
if (is_ios) {
|
||||
_object_path_suffix = ",persist"
|
||||
}
|
||||
ldflags += [
|
||||
"-Wl,-cache_path_lto," +
|
||||
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
||||
"-Wcrl,object_path_lto",
|
||||
"-Wcrl,object_path_lto" + _object_path_suffix,
|
||||
]
|
||||
} else {
|
||||
ldflags +=
|
||||
|
@ -782,6 +803,17 @@ config("compiler") {
|
|||
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
|
||||
# Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
|
||||
# The "release" ML model is embedded into clang as part of its build.
|
||||
|
@ -958,8 +990,7 @@ config("compiler_cpu_abi") {
|
|||
ldflags += [ "--target=aarch64-linux-gnu", "-Wl,-O3", "-Wno-unused-command-line-argument", ]
|
||||
}
|
||||
if (is_android) {
|
||||
# Outline atomics crash on Exynos 9810. http://crbug.com/1272795
|
||||
cflags += [ "-mno-outline-atomics", "-O3", ]
|
||||
cflags += [ "-O3", ]
|
||||
ldflags += [ "-Wl,-O3", ]
|
||||
}
|
||||
} else if (current_cpu == "mipsel" && !is_nacl) {
|
||||
|
@ -2059,7 +2090,6 @@ if (is_win) {
|
|||
|
||||
# /OPT:ICF is not desirable in Debug builds, since code-folding can result in
|
||||
# misleading symbols in stack traces.
|
||||
|
||||
if (!is_debug && !is_component_build) {
|
||||
common_optimize_on_ldflags += [ "/OPT:ICF" ] # Redundant COMDAT folding.
|
||||
}
|
||||
|
@ -2466,7 +2496,8 @@ config("symbols") {
|
|||
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) {
|
||||
cflags += [ "-gdwarf-5" ]
|
||||
} else if (!is_apple) {
|
||||
|
@ -2494,9 +2525,6 @@ config("symbols") {
|
|||
# It is skipped in tsan and asan because enabling it causes some
|
||||
# formatting changes in the output which would require fixing bunches
|
||||
# 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" ]
|
||||
}
|
||||
|
||||
|
@ -2599,7 +2627,8 @@ config("minimal_symbols") {
|
|||
# at least 10.11.
|
||||
# TODO(thakis): Remove this once mac_deployment_target is 10.11.
|
||||
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
|
||||
# to switch. TODO: Adopt that in controlled way.
|
||||
cflags += [ "-gdwarf-4" ]
|
||||
|
|
Loading…
Reference in a new issue