mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-10 03:47:44 -03:00
update main BUILD.gns
This commit is contained in:
parent
d8df100bd9
commit
de7c195f7c
6 changed files with 411 additions and 169 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2023 The Chromium Authors and Alex313031
|
# Copyright 2024 The Chromium Authors and Alex313031
|
||||||
# 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.
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import("//build/config/rust.gni")
|
||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//build/config/unwind.gni")
|
import("//build/config/unwind.gni")
|
||||||
import("//build/toolchain/cc_wrapper.gni")
|
import("//build/toolchain/cc_wrapper.gni")
|
||||||
|
import("//build/toolchain/cros/cros_config.gni")
|
||||||
import("//build/toolchain/goma.gni")
|
import("//build/toolchain/goma.gni")
|
||||||
import("//build/toolchain/rbe.gni")
|
import("//build/toolchain/rbe.gni")
|
||||||
import("//build/toolchain/toolchain.gni")
|
import("//build/toolchain/toolchain.gni")
|
||||||
|
@ -74,6 +75,9 @@ declare_args() {
|
||||||
# Whether to enable LLVM's Polly optimizations. See https://polly.llvm.org/
|
# Whether to enable LLVM's Polly optimizations. See https://polly.llvm.org/
|
||||||
use_polly = false
|
use_polly = false
|
||||||
|
|
||||||
|
# Whether to use Raspberry Pi specific optimizations.
|
||||||
|
is_raspi = false
|
||||||
|
|
||||||
# Enable fatal linker warnings. Building Chromium with certain versions
|
# Enable fatal linker warnings. Building Chromium with certain versions
|
||||||
# of binutils can cause linker warning.
|
# of binutils can cause linker warning.
|
||||||
fatal_linker_warnings = true
|
fatal_linker_warnings = true
|
||||||
|
@ -135,6 +139,11 @@ declare_args() {
|
||||||
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
||||||
(is_ios && use_lld)) && is_official_build
|
(is_ios && use_lld)) && is_official_build
|
||||||
|
|
||||||
|
# Whether to enable thin lto incremental builds.
|
||||||
|
# See: https://clang.llvm.org/docs/ThinLTO.html#incremental
|
||||||
|
# The cache can lead to non-determinism: https://crbug.com/1486045
|
||||||
|
thin_lto_enable_cache = false
|
||||||
|
|
||||||
# Initialize all local variables with a pattern. This flag will fill
|
# Initialize all local variables with a pattern. This flag will fill
|
||||||
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
||||||
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
||||||
|
@ -489,6 +498,11 @@ config("compiler") {
|
||||||
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# dsymutil is not available in the system, on bots, for rustc to call. Our
|
||||||
|
# linker_driver.py script runs dsymutil itself, which is set to be the
|
||||||
|
# linker for Rust targets as well.
|
||||||
|
rustflags += [ "-Csplit-debuginfo=unpacked" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Linux/Android/Fuchsia common flags setup.
|
# Linux/Android/Fuchsia common flags setup.
|
||||||
|
@ -619,6 +633,24 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO(crbug.com/1488374): This causes binary size growth and potentially
|
||||||
|
# other problems.
|
||||||
|
# TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version.
|
||||||
|
if (default_toolchain != "//build/toolchain/cros:target" &&
|
||||||
|
!llvm_android_mainline) {
|
||||||
|
cflags += [
|
||||||
|
"-mllvm",
|
||||||
|
"-split-threshold-for-reg-with-hint=0",
|
||||||
|
]
|
||||||
|
if (use_thin_lto && is_a_target_toolchain) {
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
cflags += [ "/clang:-ffp-contract=fast" ]
|
cflags += [ "/clang:-ffp-contract=fast" ]
|
||||||
|
@ -675,8 +707,7 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags_c += [ "/std:c11" ]
|
cflags_c += [ "/std:c11" ]
|
||||||
if ((defined(use_cxx17) && use_cxx17) ||
|
if (defined(use_cxx17) && use_cxx17) {
|
||||||
(!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17)) {
|
|
||||||
cflags_cc += [ "/std:c++17" ]
|
cflags_cc += [ "/std:c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "/std:c++20" ]
|
cflags_cc += [ "/std:c++20" ]
|
||||||
|
@ -723,9 +754,26 @@ config("compiler") {
|
||||||
"-fsplit-lto-unit",
|
"-fsplit-lto-unit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (thin_lto_enable_cache) {
|
||||||
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
||||||
# available disk space, 40GB and 100000 files.
|
# available disk space, 40GB and 100000 files.
|
||||||
# cache_policy = "cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
cache_policy =
|
||||||
|
"cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
||||||
|
cache_dir = rebase_path("$root_out_dir/thinlto-cache", root_build_dir)
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [
|
||||||
|
"/lldltocache:$cache_dir",
|
||||||
|
"/lldltocachepolicy:$cache_policy",
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wl,-cache_path_lto,$cache_dir" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-dir=$cache_dir" ]
|
||||||
|
}
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# An import limit of 30 has better performance (per speedometer) and lower
|
# An import limit of 30 has better performance (per speedometer) and lower
|
||||||
# binary size than the default setting of 100.
|
# binary size than the default setting of 100.
|
||||||
|
@ -740,9 +788,6 @@ config("compiler") {
|
||||||
"-mllvm:-import-hot-multiplier=15",
|
"-mllvm:-import-hot-multiplier=15",
|
||||||
"-mllvm:-import-cold-multiplier=2",
|
"-mllvm:-import-cold-multiplier=2",
|
||||||
"-mllvm:-disable-auto-upgrade-debug-info",
|
"-mllvm:-disable-auto-upgrade-debug-info",
|
||||||
# "/lldltocache:" +
|
|
||||||
# rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
# "/lldltocachepolicy:$cache_policy",
|
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
ldflags += [ "-flto=thin" ]
|
ldflags += [ "-flto=thin" ]
|
||||||
|
@ -756,18 +801,6 @@ config("compiler") {
|
||||||
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
||||||
# 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) {
|
|
||||||
ldflags += [
|
|
||||||
"-Wl,-cache_path_lto," +
|
|
||||||
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
"-Wcrl,object_path_lto",
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
ldflags +=
|
|
||||||
[ "-Wl,-O3" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
|
||||||
|
|
||||||
if (is_chromeos) {
|
if (is_chromeos) {
|
||||||
# ARM was originally set lower than x86 to keep the size
|
# ARM was originally set lower than x86 to keep the size
|
||||||
|
@ -783,6 +816,10 @@ config("compiler") {
|
||||||
|
|
||||||
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
||||||
|
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wcrl,object_path_lto" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_chromeos) {
|
if (!is_chromeos) {
|
||||||
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
||||||
# toolchain has this flag.
|
# toolchain has this flag.
|
||||||
|
@ -832,6 +869,9 @@ config("compiler") {
|
||||||
if (compiler_timing) {
|
if (compiler_timing) {
|
||||||
if (is_clang && !is_nacl) {
|
if (is_clang && !is_nacl) {
|
||||||
cflags += [ "-ftime-trace" ]
|
cflags += [ "-ftime-trace" ]
|
||||||
|
if (use_lld && is_mac) {
|
||||||
|
ldflags += [ "-Wl,--time-trace" ]
|
||||||
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# "Documented" here:
|
# "Documented" here:
|
||||||
|
@ -1145,11 +1185,16 @@ config("compiler_cpu_abi") {
|
||||||
cflags += [
|
cflags += [
|
||||||
"-m64",
|
"-m64",
|
||||||
"-O3",
|
"-O3",
|
||||||
|
"-msse3",
|
||||||
|
"-mssse3",
|
||||||
|
"-msse4",
|
||||||
|
"-msse4.1",
|
||||||
|
"-msse4.2",
|
||||||
"-mavx",
|
"-mavx",
|
||||||
"-maes",
|
"-maes",
|
||||||
"-mpclmul",
|
"-mpclmul",
|
||||||
]
|
]
|
||||||
ldflags += [ "-m64", "-Wl,-O3", "-mavx", "-maes", "-mpclmul", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=2", ]
|
ldflags += [ "-m64", "-Wl,-O3", "-msse3", "-mssse3", "-msse4", "-msse4.1", "-msse4.2", "-mavx", "-maes", "-mpclmul", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=2", ]
|
||||||
} else if (current_cpu == "x86") {
|
} else if (current_cpu == "x86") {
|
||||||
cflags += [ "-m32" ]
|
cflags += [ "-m32" ]
|
||||||
ldflags += [ "-m32", "-Wl,-O3", "-msse3", ]
|
ldflags += [ "-m32", "-Wl,-O3", "-msse3", ]
|
||||||
|
@ -1858,14 +1903,6 @@ config("default_warnings") {
|
||||||
"-Wno-ignored-pragma-optimize",
|
"-Wno-ignored-pragma-optimize",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (llvm_force_head_revision && !is_nacl && enable_precompiled_headers &&
|
|
||||||
!is_win) {
|
|
||||||
cflags += [
|
|
||||||
# TODO(crbug.com/1486799) Find a long-term solution.
|
|
||||||
"-Wno-deprecated-include-gch",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_nacl) {
|
if (!is_nacl) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
||||||
|
@ -1876,6 +1913,18 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
"-Wno-deprecated-this-capture",
|
"-Wno-deprecated-this-capture",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1491833): Fix and re-enable.
|
||||||
|
"-Wno-invalid-offsetof",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1494809): Evaluate and possibly enable.
|
||||||
|
"-Wno-vla-extension",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1490607): Fix and re-enable.
|
||||||
|
"-Wno-thread-safety-reference-return",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1495100): Evaluate and possibly enable.
|
||||||
|
"-Wno-delayed-template-parsing-in-cxx20",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1976,9 +2025,10 @@ config("chromium_code") {
|
||||||
# disabled, so only do that for Release build.
|
# disabled, so only do that for Release build.
|
||||||
fortify_level = "2"
|
fortify_level = "2"
|
||||||
|
|
||||||
# ChromeOS supports a high-quality _FORTIFY_SOURCE=3 implementation
|
# ChromeOS's toolchain supports a high-quality _FORTIFY_SOURCE=3
|
||||||
# with a few custom glibc patches. Use that if it's available.
|
# implementation with a few custom glibc patches. Use that if it's
|
||||||
if (is_chromeos_ash) {
|
# available.
|
||||||
|
if (is_chromeos_device && !lacros_use_chromium_toolchain) {
|
||||||
fortify_level = "3"
|
fortify_level = "3"
|
||||||
}
|
}
|
||||||
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
||||||
|
@ -2281,6 +2331,10 @@ if (is_win) {
|
||||||
"-Xclang", "-O3",
|
"-Xclang", "-O3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (current_cpu == "arm64") {
|
||||||
|
common_optimize_on_ldflags += [ "-march=armv8-a+simd", ]
|
||||||
|
}
|
||||||
|
|
||||||
common_optimize_on_ldflags += [
|
common_optimize_on_ldflags += [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2313,10 +2367,22 @@ if (is_win) {
|
||||||
common_optimize_on_cflags = []
|
common_optimize_on_cflags = []
|
||||||
common_optimize_on_ldflags = []
|
common_optimize_on_ldflags = []
|
||||||
|
|
||||||
|
if (current_cpu == "arm64") {
|
||||||
|
common_optimize_on_cflags += [ "-march=armv8-a+simd", ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_raspi == true) {
|
||||||
|
common_optimize_on_cflags += [ "-mtune=cortex-a72", ]
|
||||||
|
}
|
||||||
|
|
||||||
common_optimize_on_cflags += [
|
common_optimize_on_cflags += [
|
||||||
"-O3",
|
"-O3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (current_cpu == "arm64") {
|
||||||
|
common_optimize_on_ldflags += [ "-march=armv8-a+simd", ]
|
||||||
|
}
|
||||||
|
|
||||||
common_optimize_on_ldflags += [
|
common_optimize_on_ldflags += [
|
||||||
"-Wl,-O3",
|
"-Wl,-O3",
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,6 +4,7 @@ google_default_client_secret = ""
|
||||||
target_os = "linux"
|
target_os = "linux"
|
||||||
target_cpu = "arm64"
|
target_cpu = "arm64"
|
||||||
v8_target_cpu = "arm64"
|
v8_target_cpu = "arm64"
|
||||||
|
is_raspi = true
|
||||||
# sysroot = "/home/alex/chromium/src/build/linux/debian_bullseye_arm64-sysroot"
|
# sysroot = "/home/alex/chromium/src/build/linux/debian_bullseye_arm64-sysroot"
|
||||||
arm_version = 8
|
arm_version = 8
|
||||||
arm_arch = "armv8-a"
|
arm_arch = "armv8-a"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2023 The Chromium Authors and Alex313031
|
# Copyright 2024 The Chromium Authors and Alex313031
|
||||||
# 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.
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import("//build/config/rust.gni")
|
||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//build/config/unwind.gni")
|
import("//build/config/unwind.gni")
|
||||||
import("//build/toolchain/cc_wrapper.gni")
|
import("//build/toolchain/cc_wrapper.gni")
|
||||||
|
import("//build/toolchain/cros/cros_config.gni")
|
||||||
import("//build/toolchain/goma.gni")
|
import("//build/toolchain/goma.gni")
|
||||||
import("//build/toolchain/rbe.gni")
|
import("//build/toolchain/rbe.gni")
|
||||||
import("//build/toolchain/toolchain.gni")
|
import("//build/toolchain/toolchain.gni")
|
||||||
|
@ -135,6 +136,11 @@ declare_args() {
|
||||||
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
||||||
(is_ios && use_lld)) && is_official_build
|
(is_ios && use_lld)) && is_official_build
|
||||||
|
|
||||||
|
# Whether to enable thin lto incremental builds.
|
||||||
|
# See: https://clang.llvm.org/docs/ThinLTO.html#incremental
|
||||||
|
# The cache can lead to non-determinism: https://crbug.com/1486045
|
||||||
|
thin_lto_enable_cache = false
|
||||||
|
|
||||||
# Initialize all local variables with a pattern. This flag will fill
|
# Initialize all local variables with a pattern. This flag will fill
|
||||||
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
||||||
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
||||||
|
@ -489,6 +495,11 @@ config("compiler") {
|
||||||
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# dsymutil is not available in the system, on bots, for rustc to call. Our
|
||||||
|
# linker_driver.py script runs dsymutil itself, which is set to be the
|
||||||
|
# linker for Rust targets as well.
|
||||||
|
rustflags += [ "-Csplit-debuginfo=unpacked" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Linux/Android/Fuchsia common flags setup.
|
# Linux/Android/Fuchsia common flags setup.
|
||||||
|
@ -619,6 +630,24 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO(crbug.com/1488374): This causes binary size growth and potentially
|
||||||
|
# other problems.
|
||||||
|
# TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version.
|
||||||
|
if (default_toolchain != "//build/toolchain/cros:target" &&
|
||||||
|
!llvm_android_mainline) {
|
||||||
|
cflags += [
|
||||||
|
"-mllvm",
|
||||||
|
"-split-threshold-for-reg-with-hint=0",
|
||||||
|
]
|
||||||
|
if (use_thin_lto && is_a_target_toolchain) {
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
cflags += [ "/clang:-ffp-contract=fast" ]
|
cflags += [ "/clang:-ffp-contract=fast" ]
|
||||||
|
@ -675,8 +704,7 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags_c += [ "/std:c11" ]
|
cflags_c += [ "/std:c11" ]
|
||||||
if ((defined(use_cxx17) && use_cxx17) ||
|
if (defined(use_cxx17) && use_cxx17) {
|
||||||
(!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17)) {
|
|
||||||
cflags_cc += [ "/std:c++17" ]
|
cflags_cc += [ "/std:c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "/std:c++20" ]
|
cflags_cc += [ "/std:c++20" ]
|
||||||
|
@ -723,9 +751,26 @@ config("compiler") {
|
||||||
"-fsplit-lto-unit",
|
"-fsplit-lto-unit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (thin_lto_enable_cache) {
|
||||||
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
||||||
# available disk space, 40GB and 100000 files.
|
# available disk space, 40GB and 100000 files.
|
||||||
# cache_policy = "cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
cache_policy =
|
||||||
|
"cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
||||||
|
cache_dir = rebase_path("$root_out_dir/thinlto-cache", root_build_dir)
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [
|
||||||
|
"/lldltocache:$cache_dir",
|
||||||
|
"/lldltocachepolicy:$cache_policy",
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wl,-cache_path_lto,$cache_dir" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-dir=$cache_dir" ]
|
||||||
|
}
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# An import limit of 30 has better performance (per speedometer) and lower
|
# An import limit of 30 has better performance (per speedometer) and lower
|
||||||
# binary size than the default setting of 100.
|
# binary size than the default setting of 100.
|
||||||
|
@ -740,9 +785,6 @@ config("compiler") {
|
||||||
"-mllvm:-import-hot-multiplier=15",
|
"-mllvm:-import-hot-multiplier=15",
|
||||||
"-mllvm:-import-cold-multiplier=2",
|
"-mllvm:-import-cold-multiplier=2",
|
||||||
"-mllvm:-disable-auto-upgrade-debug-info",
|
"-mllvm:-disable-auto-upgrade-debug-info",
|
||||||
# "/lldltocache:" +
|
|
||||||
# rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
# "/lldltocachepolicy:$cache_policy",
|
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
ldflags += [ "-flto=thin" ]
|
ldflags += [ "-flto=thin" ]
|
||||||
|
@ -756,18 +798,6 @@ config("compiler") {
|
||||||
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
||||||
# 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) {
|
|
||||||
ldflags += [
|
|
||||||
"-Wl,-cache_path_lto," +
|
|
||||||
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
"-Wcrl,object_path_lto",
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
ldflags +=
|
|
||||||
[ "-Wl,-O3" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
|
||||||
|
|
||||||
if (is_chromeos) {
|
if (is_chromeos) {
|
||||||
# ARM was originally set lower than x86 to keep the size
|
# ARM was originally set lower than x86 to keep the size
|
||||||
|
@ -783,6 +813,10 @@ config("compiler") {
|
||||||
|
|
||||||
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
||||||
|
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wcrl,object_path_lto" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_chromeos) {
|
if (!is_chromeos) {
|
||||||
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
||||||
# toolchain has this flag.
|
# toolchain has this flag.
|
||||||
|
@ -828,6 +862,9 @@ config("compiler") {
|
||||||
if (compiler_timing) {
|
if (compiler_timing) {
|
||||||
if (is_clang && !is_nacl) {
|
if (is_clang && !is_nacl) {
|
||||||
cflags += [ "-ftime-trace" ]
|
cflags += [ "-ftime-trace" ]
|
||||||
|
if (use_lld && is_mac) {
|
||||||
|
ldflags += [ "-Wl,--time-trace" ]
|
||||||
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# "Documented" here:
|
# "Documented" here:
|
||||||
|
@ -1854,14 +1891,6 @@ config("default_warnings") {
|
||||||
"-Wno-ignored-pragma-optimize",
|
"-Wno-ignored-pragma-optimize",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (llvm_force_head_revision && !is_nacl && enable_precompiled_headers &&
|
|
||||||
!is_win) {
|
|
||||||
cflags += [
|
|
||||||
# TODO(crbug.com/1486799) Find a long-term solution.
|
|
||||||
"-Wno-deprecated-include-gch",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_nacl) {
|
if (!is_nacl) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
||||||
|
@ -1872,6 +1901,18 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
"-Wno-deprecated-this-capture",
|
"-Wno-deprecated-this-capture",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1491833): Fix and re-enable.
|
||||||
|
"-Wno-invalid-offsetof",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1494809): Evaluate and possibly enable.
|
||||||
|
"-Wno-vla-extension",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1490607): Fix and re-enable.
|
||||||
|
"-Wno-thread-safety-reference-return",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1495100): Evaluate and possibly enable.
|
||||||
|
"-Wno-delayed-template-parsing-in-cxx20",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1972,9 +2013,10 @@ config("chromium_code") {
|
||||||
# disabled, so only do that for Release build.
|
# disabled, so only do that for Release build.
|
||||||
fortify_level = "2"
|
fortify_level = "2"
|
||||||
|
|
||||||
# ChromeOS supports a high-quality _FORTIFY_SOURCE=3 implementation
|
# ChromeOS's toolchain supports a high-quality _FORTIFY_SOURCE=3
|
||||||
# with a few custom glibc patches. Use that if it's available.
|
# implementation with a few custom glibc patches. Use that if it's
|
||||||
if (is_chromeos_ash) {
|
# available.
|
||||||
|
if (is_chromeos_device && !lacros_use_chromium_toolchain) {
|
||||||
fortify_level = "3"
|
fortify_level = "3"
|
||||||
}
|
}
|
||||||
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2023 The Chromium Authors and Alex313031
|
# Copyright 2024 The Chromium Authors and Alex313031
|
||||||
# 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.
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import("//build/config/rust.gni")
|
||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//build/config/unwind.gni")
|
import("//build/config/unwind.gni")
|
||||||
import("//build/toolchain/cc_wrapper.gni")
|
import("//build/toolchain/cc_wrapper.gni")
|
||||||
|
import("//build/toolchain/cros/cros_config.gni")
|
||||||
import("//build/toolchain/goma.gni")
|
import("//build/toolchain/goma.gni")
|
||||||
import("//build/toolchain/rbe.gni")
|
import("//build/toolchain/rbe.gni")
|
||||||
import("//build/toolchain/toolchain.gni")
|
import("//build/toolchain/toolchain.gni")
|
||||||
|
@ -135,6 +136,11 @@ declare_args() {
|
||||||
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
||||||
(is_ios && use_lld)) && is_official_build
|
(is_ios && use_lld)) && is_official_build
|
||||||
|
|
||||||
|
# Whether to enable thin lto incremental builds.
|
||||||
|
# See: https://clang.llvm.org/docs/ThinLTO.html#incremental
|
||||||
|
# The cache can lead to non-determinism: https://crbug.com/1486045
|
||||||
|
thin_lto_enable_cache = false
|
||||||
|
|
||||||
# Initialize all local variables with a pattern. This flag will fill
|
# Initialize all local variables with a pattern. This flag will fill
|
||||||
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
||||||
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
||||||
|
@ -489,6 +495,11 @@ config("compiler") {
|
||||||
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# dsymutil is not available in the system, on bots, for rustc to call. Our
|
||||||
|
# linker_driver.py script runs dsymutil itself, which is set to be the
|
||||||
|
# linker for Rust targets as well.
|
||||||
|
rustflags += [ "-Csplit-debuginfo=unpacked" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Linux/Android/Fuchsia common flags setup.
|
# Linux/Android/Fuchsia common flags setup.
|
||||||
|
@ -619,6 +630,24 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO(crbug.com/1488374): This causes binary size growth and potentially
|
||||||
|
# other problems.
|
||||||
|
# TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version.
|
||||||
|
if (default_toolchain != "//build/toolchain/cros:target" &&
|
||||||
|
!llvm_android_mainline) {
|
||||||
|
cflags += [
|
||||||
|
"-mllvm",
|
||||||
|
"-split-threshold-for-reg-with-hint=0",
|
||||||
|
]
|
||||||
|
if (use_thin_lto && is_a_target_toolchain) {
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
cflags += [ "/clang:-ffp-contract=off" ]
|
cflags += [ "/clang:-ffp-contract=off" ]
|
||||||
|
@ -675,8 +704,7 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags_c += [ "/std:c11" ]
|
cflags_c += [ "/std:c11" ]
|
||||||
if ((defined(use_cxx17) && use_cxx17) ||
|
if (defined(use_cxx17) && use_cxx17) {
|
||||||
(!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17)) {
|
|
||||||
cflags_cc += [ "/std:c++17" ]
|
cflags_cc += [ "/std:c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "/std:c++20" ]
|
cflags_cc += [ "/std:c++20" ]
|
||||||
|
@ -723,9 +751,26 @@ config("compiler") {
|
||||||
"-fsplit-lto-unit",
|
"-fsplit-lto-unit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (thin_lto_enable_cache) {
|
||||||
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
||||||
# available disk space, 40GB and 100000 files.
|
# available disk space, 40GB and 100000 files.
|
||||||
# cache_policy = "cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
cache_policy =
|
||||||
|
"cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
||||||
|
cache_dir = rebase_path("$root_out_dir/thinlto-cache", root_build_dir)
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [
|
||||||
|
"/lldltocache:$cache_dir",
|
||||||
|
"/lldltocachepolicy:$cache_policy",
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wl,-cache_path_lto,$cache_dir" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-dir=$cache_dir" ]
|
||||||
|
}
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# An import limit of 30 has better performance (per speedometer) and lower
|
# An import limit of 30 has better performance (per speedometer) and lower
|
||||||
# binary size than the default setting of 100.
|
# binary size than the default setting of 100.
|
||||||
|
@ -740,9 +785,6 @@ config("compiler") {
|
||||||
"-mllvm:-import-hot-multiplier=15",
|
"-mllvm:-import-hot-multiplier=15",
|
||||||
"-mllvm:-import-cold-multiplier=2",
|
"-mllvm:-import-cold-multiplier=2",
|
||||||
"-mllvm:-disable-auto-upgrade-debug-info",
|
"-mllvm:-disable-auto-upgrade-debug-info",
|
||||||
# "/lldltocache:" +
|
|
||||||
# rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
# "/lldltocachepolicy:$cache_policy",
|
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
ldflags += [ "-flto=thin" ]
|
ldflags += [ "-flto=thin" ]
|
||||||
|
@ -756,18 +798,6 @@ config("compiler") {
|
||||||
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
||||||
# 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) {
|
|
||||||
ldflags += [
|
|
||||||
"-Wl,-cache_path_lto," +
|
|
||||||
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
"-Wcrl,object_path_lto",
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
ldflags +=
|
|
||||||
[ "-Wl,-O3" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
|
||||||
|
|
||||||
if (is_chromeos) {
|
if (is_chromeos) {
|
||||||
# ARM was originally set lower than x86 to keep the size
|
# ARM was originally set lower than x86 to keep the size
|
||||||
|
@ -783,6 +813,10 @@ config("compiler") {
|
||||||
|
|
||||||
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
||||||
|
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wcrl,object_path_lto" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_chromeos) {
|
if (!is_chromeos) {
|
||||||
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
||||||
# toolchain has this flag.
|
# toolchain has this flag.
|
||||||
|
@ -828,6 +862,9 @@ config("compiler") {
|
||||||
if (compiler_timing) {
|
if (compiler_timing) {
|
||||||
if (is_clang && !is_nacl) {
|
if (is_clang && !is_nacl) {
|
||||||
cflags += [ "-ftime-trace" ]
|
cflags += [ "-ftime-trace" ]
|
||||||
|
if (use_lld && is_mac) {
|
||||||
|
ldflags += [ "-Wl,--time-trace" ]
|
||||||
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# "Documented" here:
|
# "Documented" here:
|
||||||
|
@ -1141,9 +1178,12 @@ config("compiler_cpu_abi") {
|
||||||
cflags += [
|
cflags += [
|
||||||
"-m64",
|
"-m64",
|
||||||
"-O3",
|
"-O3",
|
||||||
|
"-msse3",
|
||||||
|
"-mssse3",
|
||||||
|
"-msse4",
|
||||||
"-msse4.1",
|
"-msse4.1",
|
||||||
]
|
]
|
||||||
ldflags += [ "-m64", "-Wl,-O3", "-msse4.1", ]
|
ldflags += [ "-m64", "-Wl,-O3", "-msse3", "-mssse3", "-msse4", "-msse4.1", ]
|
||||||
} else if (current_cpu == "x86") {
|
} else if (current_cpu == "x86") {
|
||||||
cflags += [ "-m32" ]
|
cflags += [ "-m32" ]
|
||||||
ldflags += [ "-m32", "-Wl,-O3", "-msse3", ]
|
ldflags += [ "-m32", "-Wl,-O3", "-msse3", ]
|
||||||
|
@ -1852,14 +1892,6 @@ config("default_warnings") {
|
||||||
"-Wno-ignored-pragma-optimize",
|
"-Wno-ignored-pragma-optimize",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (llvm_force_head_revision && !is_nacl && enable_precompiled_headers &&
|
|
||||||
!is_win) {
|
|
||||||
cflags += [
|
|
||||||
# TODO(crbug.com/1486799) Find a long-term solution.
|
|
||||||
"-Wno-deprecated-include-gch",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_nacl) {
|
if (!is_nacl) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
||||||
|
@ -1870,6 +1902,18 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
"-Wno-deprecated-this-capture",
|
"-Wno-deprecated-this-capture",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1491833): Fix and re-enable.
|
||||||
|
"-Wno-invalid-offsetof",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1494809): Evaluate and possibly enable.
|
||||||
|
"-Wno-vla-extension",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1490607): Fix and re-enable.
|
||||||
|
"-Wno-thread-safety-reference-return",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1495100): Evaluate and possibly enable.
|
||||||
|
"-Wno-delayed-template-parsing-in-cxx20",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1970,9 +2014,10 @@ config("chromium_code") {
|
||||||
# disabled, so only do that for Release build.
|
# disabled, so only do that for Release build.
|
||||||
fortify_level = "2"
|
fortify_level = "2"
|
||||||
|
|
||||||
# ChromeOS supports a high-quality _FORTIFY_SOURCE=3 implementation
|
# ChromeOS's toolchain supports a high-quality _FORTIFY_SOURCE=3
|
||||||
# with a few custom glibc patches. Use that if it's available.
|
# implementation with a few custom glibc patches. Use that if it's
|
||||||
if (is_chromeos_ash) {
|
# available.
|
||||||
|
if (is_chromeos_device && !lacros_use_chromium_toolchain) {
|
||||||
fortify_level = "3"
|
fortify_level = "3"
|
||||||
}
|
}
|
||||||
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
||||||
|
@ -2284,6 +2329,9 @@ if (is_win) {
|
||||||
"-mllvm", "-enable-dfa-jump-thread",
|
"-mllvm", "-enable-dfa-jump-thread",
|
||||||
"/O2",
|
"/O2",
|
||||||
"/clang:-O3",
|
"/clang:-O3",
|
||||||
|
"/clang:-msse3",
|
||||||
|
"/clang:-mssse3",
|
||||||
|
"/clang:-msse4",
|
||||||
"/clang:-msse4.1",
|
"/clang:-msse4.1",
|
||||||
"-Xclang", "-O3",
|
"-Xclang", "-O3",
|
||||||
]
|
]
|
||||||
|
@ -2342,6 +2390,7 @@ if (is_win) {
|
||||||
]
|
]
|
||||||
|
|
||||||
common_optimize_on_ldflags += [
|
common_optimize_on_ldflags += [
|
||||||
|
"-Wl,-mllvm,-freroll-loops",
|
||||||
"-Wl,-mllvm,-enable-gvn-hoist",
|
"-Wl,-mllvm,-enable-gvn-hoist",
|
||||||
"-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=2",
|
"-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=2",
|
||||||
"-Wl,-O3",
|
"-Wl,-O3",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2023 The Chromium Authors and Alex313031
|
# Copyright 2024 The Chromium Authors and Alex313031
|
||||||
# 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.
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import("//build/config/rust.gni")
|
||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//build/config/unwind.gni")
|
import("//build/config/unwind.gni")
|
||||||
import("//build/toolchain/cc_wrapper.gni")
|
import("//build/toolchain/cc_wrapper.gni")
|
||||||
|
import("//build/toolchain/cros/cros_config.gni")
|
||||||
import("//build/toolchain/goma.gni")
|
import("//build/toolchain/goma.gni")
|
||||||
import("//build/toolchain/rbe.gni")
|
import("//build/toolchain/rbe.gni")
|
||||||
import("//build/toolchain/toolchain.gni")
|
import("//build/toolchain/toolchain.gni")
|
||||||
|
@ -135,6 +136,11 @@ declare_args() {
|
||||||
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
||||||
(is_ios && use_lld)) && is_official_build
|
(is_ios && use_lld)) && is_official_build
|
||||||
|
|
||||||
|
# Whether to enable thin lto incremental builds.
|
||||||
|
# See: https://clang.llvm.org/docs/ThinLTO.html#incremental
|
||||||
|
# The cache can lead to non-determinism: https://crbug.com/1486045
|
||||||
|
thin_lto_enable_cache = false
|
||||||
|
|
||||||
# Initialize all local variables with a pattern. This flag will fill
|
# Initialize all local variables with a pattern. This flag will fill
|
||||||
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
||||||
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
||||||
|
@ -489,6 +495,11 @@ config("compiler") {
|
||||||
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# dsymutil is not available in the system, on bots, for rustc to call. Our
|
||||||
|
# linker_driver.py script runs dsymutil itself, which is set to be the
|
||||||
|
# linker for Rust targets as well.
|
||||||
|
rustflags += [ "-Csplit-debuginfo=unpacked" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Linux/Android/Fuchsia common flags setup.
|
# Linux/Android/Fuchsia common flags setup.
|
||||||
|
@ -619,6 +630,24 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO(crbug.com/1488374): This causes binary size growth and potentially
|
||||||
|
# other problems.
|
||||||
|
# TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version.
|
||||||
|
if (default_toolchain != "//build/toolchain/cros:target" &&
|
||||||
|
!llvm_android_mainline) {
|
||||||
|
cflags += [
|
||||||
|
"-mllvm",
|
||||||
|
"-split-threshold-for-reg-with-hint=0",
|
||||||
|
]
|
||||||
|
if (use_thin_lto && is_a_target_toolchain) {
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
cflags += [ "/clang:-ffp-contract=off" ]
|
cflags += [ "/clang:-ffp-contract=off" ]
|
||||||
|
@ -675,8 +704,7 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags_c += [ "/std:c11" ]
|
cflags_c += [ "/std:c11" ]
|
||||||
if ((defined(use_cxx17) && use_cxx17) ||
|
if (defined(use_cxx17) && use_cxx17) {
|
||||||
(!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17)) {
|
|
||||||
cflags_cc += [ "/std:c++17" ]
|
cflags_cc += [ "/std:c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "/std:c++20" ]
|
cflags_cc += [ "/std:c++20" ]
|
||||||
|
@ -723,9 +751,26 @@ config("compiler") {
|
||||||
"-fsplit-lto-unit",
|
"-fsplit-lto-unit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (thin_lto_enable_cache) {
|
||||||
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
||||||
# available disk space, 40GB and 100000 files.
|
# available disk space, 40GB and 100000 files.
|
||||||
# cache_policy = "cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
cache_policy =
|
||||||
|
"cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
||||||
|
cache_dir = rebase_path("$root_out_dir/thinlto-cache", root_build_dir)
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [
|
||||||
|
"/lldltocache:$cache_dir",
|
||||||
|
"/lldltocachepolicy:$cache_policy",
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wl,-cache_path_lto,$cache_dir" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-dir=$cache_dir" ]
|
||||||
|
}
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# An import limit of 30 has better performance (per speedometer) and lower
|
# An import limit of 30 has better performance (per speedometer) and lower
|
||||||
# binary size than the default setting of 100.
|
# binary size than the default setting of 100.
|
||||||
|
@ -740,9 +785,6 @@ config("compiler") {
|
||||||
"-mllvm:-import-hot-multiplier=15",
|
"-mllvm:-import-hot-multiplier=15",
|
||||||
"-mllvm:-import-cold-multiplier=2",
|
"-mllvm:-import-cold-multiplier=2",
|
||||||
"-mllvm:-disable-auto-upgrade-debug-info",
|
"-mllvm:-disable-auto-upgrade-debug-info",
|
||||||
# "/lldltocache:" +
|
|
||||||
# rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
# "/lldltocachepolicy:$cache_policy",
|
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
ldflags += [ "-flto=thin" ]
|
ldflags += [ "-flto=thin" ]
|
||||||
|
@ -756,18 +798,6 @@ config("compiler") {
|
||||||
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
||||||
# 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) {
|
|
||||||
ldflags += [
|
|
||||||
"-Wl,-cache_path_lto," +
|
|
||||||
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
"-Wcrl,object_path_lto",
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
ldflags +=
|
|
||||||
[ "-Wl,-O3" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
|
||||||
|
|
||||||
if (is_chromeos) {
|
if (is_chromeos) {
|
||||||
# ARM was originally set lower than x86 to keep the size
|
# ARM was originally set lower than x86 to keep the size
|
||||||
|
@ -783,6 +813,10 @@ config("compiler") {
|
||||||
|
|
||||||
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
||||||
|
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wcrl,object_path_lto" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_chromeos) {
|
if (!is_chromeos) {
|
||||||
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
||||||
# toolchain has this flag.
|
# toolchain has this flag.
|
||||||
|
@ -828,6 +862,9 @@ config("compiler") {
|
||||||
if (compiler_timing) {
|
if (compiler_timing) {
|
||||||
if (is_clang && !is_nacl) {
|
if (is_clang && !is_nacl) {
|
||||||
cflags += [ "-ftime-trace" ]
|
cflags += [ "-ftime-trace" ]
|
||||||
|
if (use_lld && is_mac) {
|
||||||
|
ldflags += [ "-Wl,--time-trace" ]
|
||||||
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# "Documented" here:
|
# "Documented" here:
|
||||||
|
@ -1852,14 +1889,6 @@ config("default_warnings") {
|
||||||
"-Wno-ignored-pragma-optimize",
|
"-Wno-ignored-pragma-optimize",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (llvm_force_head_revision && !is_nacl && enable_precompiled_headers &&
|
|
||||||
!is_win) {
|
|
||||||
cflags += [
|
|
||||||
# TODO(crbug.com/1486799) Find a long-term solution.
|
|
||||||
"-Wno-deprecated-include-gch",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_nacl) {
|
if (!is_nacl) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
||||||
|
@ -1870,6 +1899,18 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
"-Wno-deprecated-this-capture",
|
"-Wno-deprecated-this-capture",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1491833): Fix and re-enable.
|
||||||
|
"-Wno-invalid-offsetof",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1494809): Evaluate and possibly enable.
|
||||||
|
"-Wno-vla-extension",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1490607): Fix and re-enable.
|
||||||
|
"-Wno-thread-safety-reference-return",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1495100): Evaluate and possibly enable.
|
||||||
|
"-Wno-delayed-template-parsing-in-cxx20",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1970,9 +2011,10 @@ config("chromium_code") {
|
||||||
# disabled, so only do that for Release build.
|
# disabled, so only do that for Release build.
|
||||||
fortify_level = "2"
|
fortify_level = "2"
|
||||||
|
|
||||||
# ChromeOS supports a high-quality _FORTIFY_SOURCE=3 implementation
|
# ChromeOS's toolchain supports a high-quality _FORTIFY_SOURCE=3
|
||||||
# with a few custom glibc patches. Use that if it's available.
|
# implementation with a few custom glibc patches. Use that if it's
|
||||||
if (is_chromeos_ash) {
|
# available.
|
||||||
|
if (is_chromeos_device && !lacros_use_chromium_toolchain) {
|
||||||
fortify_level = "3"
|
fortify_level = "3"
|
||||||
}
|
}
|
||||||
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2023 The Chromium Authors and Alex313031
|
# Copyright 2024 The Chromium Authors and Alex313031
|
||||||
# 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.
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import("//build/config/rust.gni")
|
||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//build/config/unwind.gni")
|
import("//build/config/unwind.gni")
|
||||||
import("//build/toolchain/cc_wrapper.gni")
|
import("//build/toolchain/cc_wrapper.gni")
|
||||||
|
import("//build/toolchain/cros/cros_config.gni")
|
||||||
import("//build/toolchain/goma.gni")
|
import("//build/toolchain/goma.gni")
|
||||||
import("//build/toolchain/rbe.gni")
|
import("//build/toolchain/rbe.gni")
|
||||||
import("//build/toolchain/toolchain.gni")
|
import("//build/toolchain/toolchain.gni")
|
||||||
|
@ -135,6 +136,11 @@ declare_args() {
|
||||||
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
(is_chromeos || is_android || is_win || is_linux || is_mac ||
|
||||||
(is_ios && use_lld)) && is_official_build
|
(is_ios && use_lld)) && is_official_build
|
||||||
|
|
||||||
|
# Whether to enable thin lto incremental builds.
|
||||||
|
# See: https://clang.llvm.org/docs/ThinLTO.html#incremental
|
||||||
|
# The cache can lead to non-determinism: https://crbug.com/1486045
|
||||||
|
thin_lto_enable_cache = false
|
||||||
|
|
||||||
# Initialize all local variables with a pattern. This flag will fill
|
# Initialize all local variables with a pattern. This flag will fill
|
||||||
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
|
||||||
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
# rest with 0xAA. This makes behavior of uninitialized memory bugs consistent,
|
||||||
|
@ -489,6 +495,11 @@ config("compiler") {
|
||||||
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# dsymutil is not available in the system, on bots, for rustc to call. Our
|
||||||
|
# linker_driver.py script runs dsymutil itself, which is set to be the
|
||||||
|
# linker for Rust targets as well.
|
||||||
|
rustflags += [ "-Csplit-debuginfo=unpacked" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Linux/Android/Fuchsia common flags setup.
|
# Linux/Android/Fuchsia common flags setup.
|
||||||
|
@ -619,6 +630,24 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO(crbug.com/1488374): This causes binary size growth and potentially
|
||||||
|
# other problems.
|
||||||
|
# TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version.
|
||||||
|
if (default_toolchain != "//build/toolchain/cros:target" &&
|
||||||
|
!llvm_android_mainline) {
|
||||||
|
cflags += [
|
||||||
|
"-mllvm",
|
||||||
|
"-split-threshold-for-reg-with-hint=0",
|
||||||
|
]
|
||||||
|
if (use_thin_lto && is_a_target_toolchain) {
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
cflags += [ "/clang:-ffp-contract=off" ]
|
cflags += [ "/clang:-ffp-contract=off" ]
|
||||||
|
@ -675,8 +704,7 @@ config("compiler") {
|
||||||
}
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags_c += [ "/std:c11" ]
|
cflags_c += [ "/std:c11" ]
|
||||||
if ((defined(use_cxx17) && use_cxx17) ||
|
if (defined(use_cxx17) && use_cxx17) {
|
||||||
(!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17)) {
|
|
||||||
cflags_cc += [ "/std:c++17" ]
|
cflags_cc += [ "/std:c++17" ]
|
||||||
} else {
|
} else {
|
||||||
cflags_cc += [ "/std:c++20" ]
|
cflags_cc += [ "/std:c++20" ]
|
||||||
|
@ -723,9 +751,26 @@ config("compiler") {
|
||||||
"-fsplit-lto-unit",
|
"-fsplit-lto-unit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (thin_lto_enable_cache) {
|
||||||
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
# Limit the size of the ThinLTO cache to the lesser of 10% of
|
||||||
# available disk space, 40GB and 100000 files.
|
# available disk space, 40GB and 100000 files.
|
||||||
# cache_policy = "cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
cache_policy =
|
||||||
|
"cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
|
||||||
|
cache_dir = rebase_path("$root_out_dir/thinlto-cache", root_build_dir)
|
||||||
|
if (is_win) {
|
||||||
|
ldflags += [
|
||||||
|
"/lldltocache:$cache_dir",
|
||||||
|
"/lldltocachepolicy:$cache_policy",
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wl,-cache_path_lto,$cache_dir" ]
|
||||||
|
} else {
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-dir=$cache_dir" ]
|
||||||
|
}
|
||||||
|
ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# An import limit of 30 has better performance (per speedometer) and lower
|
# An import limit of 30 has better performance (per speedometer) and lower
|
||||||
# binary size than the default setting of 100.
|
# binary size than the default setting of 100.
|
||||||
|
@ -740,9 +785,6 @@ config("compiler") {
|
||||||
"-mllvm:-import-hot-multiplier=15",
|
"-mllvm:-import-hot-multiplier=15",
|
||||||
"-mllvm:-import-cold-multiplier=2",
|
"-mllvm:-import-cold-multiplier=2",
|
||||||
"-mllvm:-disable-auto-upgrade-debug-info",
|
"-mllvm:-disable-auto-upgrade-debug-info",
|
||||||
# "/lldltocache:" +
|
|
||||||
# rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
# "/lldltocachepolicy:$cache_policy",
|
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
ldflags += [ "-flto=thin" ]
|
ldflags += [ "-flto=thin" ]
|
||||||
|
@ -756,18 +798,6 @@ config("compiler") {
|
||||||
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
# TODO(thakis): Check if '=0' (that is, number of cores, instead
|
||||||
# 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) {
|
|
||||||
ldflags += [
|
|
||||||
"-Wl,-cache_path_lto," +
|
|
||||||
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
|
||||||
"-Wcrl,object_path_lto",
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
ldflags +=
|
|
||||||
[ "-Wl,-O3" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
|
|
||||||
|
|
||||||
if (is_chromeos) {
|
if (is_chromeos) {
|
||||||
# ARM was originally set lower than x86 to keep the size
|
# ARM was originally set lower than x86 to keep the size
|
||||||
|
@ -783,6 +813,10 @@ config("compiler") {
|
||||||
|
|
||||||
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
|
||||||
|
|
||||||
|
if (is_apple) {
|
||||||
|
ldflags += [ "-Wcrl,object_path_lto" ]
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_chromeos) {
|
if (!is_chromeos) {
|
||||||
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
|
||||||
# toolchain has this flag.
|
# toolchain has this flag.
|
||||||
|
@ -828,6 +862,9 @@ config("compiler") {
|
||||||
if (compiler_timing) {
|
if (compiler_timing) {
|
||||||
if (is_clang && !is_nacl) {
|
if (is_clang && !is_nacl) {
|
||||||
cflags += [ "-ftime-trace" ]
|
cflags += [ "-ftime-trace" ]
|
||||||
|
if (use_lld && is_mac) {
|
||||||
|
ldflags += [ "-Wl,--time-trace" ]
|
||||||
|
}
|
||||||
} else if (is_win) {
|
} else if (is_win) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# "Documented" here:
|
# "Documented" here:
|
||||||
|
@ -1062,11 +1099,11 @@ config("thinlto_optimize_default") {
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
ldflags = [ "/opt:lldlto=" + lto_opt_level ]
|
ldflags = [ "/opt:lldlto=" + lto_opt_level ]
|
||||||
ldflags += [ "-mllvm:-enable-pre=false", ]
|
ldflags += [ "-mllvm:-enable-pre=false", ]
|
||||||
# ldflags += [ "-opt:lldltocgo=" + lto_opt_level ]
|
ldflags += [ "-opt:lldltocgo=" + lto_opt_level ]
|
||||||
} else {
|
} else {
|
||||||
ldflags = [ "-Wl,--lto-O" + lto_opt_level ]
|
ldflags = [ "-Wl,--lto-O" + lto_opt_level ]
|
||||||
ldflags += [ "-Wl,--lto-CGO" + lto_opt_level ]
|
ldflags += [ "-Wl,--lto-CGO" + lto_opt_level ]
|
||||||
# ldflags += [ "-Wl,-mllvm,-enable-pre=false", ]
|
ldflags += [ "-Wl,-mllvm,-enable-pre=false", ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toolchain_supports_rust_thin_lto) {
|
if (toolchain_supports_rust_thin_lto) {
|
||||||
|
@ -1100,11 +1137,11 @@ config("thinlto_optimize_max") {
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
ldflags = [ "/opt:lldlto=" + lto_opt_level ]
|
ldflags = [ "/opt:lldlto=" + lto_opt_level ]
|
||||||
ldflags += [ "-mllvm:-enable-pre=false", ]
|
ldflags += [ "-mllvm:-enable-pre=false", ]
|
||||||
# ldflags += [ "-opt:lldltocgo=" + lto_opt_level ]
|
ldflags += [ "-opt:lldltocgo=" + lto_opt_level ]
|
||||||
} else {
|
} else {
|
||||||
ldflags = [ "-Wl,--lto-O" + lto_opt_level ]
|
ldflags = [ "-Wl,--lto-O" + lto_opt_level ]
|
||||||
ldflags += [ "-Wl,--lto-CGO" + lto_opt_level ]
|
ldflags += [ "-Wl,--lto-CGO" + lto_opt_level ]
|
||||||
# ldflags += [ "-Wl,-mllvm,-enable-pre=false", ]
|
ldflags += [ "-Wl,-mllvm,-enable-pre=false", ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toolchain_supports_rust_thin_lto) {
|
if (toolchain_supports_rust_thin_lto) {
|
||||||
|
@ -1146,11 +1183,11 @@ config("compiler_cpu_abi") {
|
||||||
"-msse4",
|
"-msse4",
|
||||||
"-msse4.1",
|
"-msse4.1",
|
||||||
"-msse4.2",
|
"-msse4.2",
|
||||||
"-mavx",
|
|
||||||
"-maes",
|
|
||||||
"-mpclmul",
|
"-mpclmul",
|
||||||
|
"-maes",
|
||||||
|
"-mavx",
|
||||||
]
|
]
|
||||||
ldflags += [ "-m64", "-Wl,-O3", "-msse3", "-mssse3", "-msse4", "-msse4.1", "-msse4.2", "-mavx", "-maes", "-mpclmul", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=2", ]
|
ldflags += [ "-m64", "-Wl,-O3", "-msse3", "-mssse3", "-msse4", "-msse4.1", "-msse4.2", "-mpclmul", "-maes", "-mavx", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=2", ]
|
||||||
} else if (current_cpu == "x86") {
|
} else if (current_cpu == "x86") {
|
||||||
cflags += [ "-m32" ]
|
cflags += [ "-m32" ]
|
||||||
ldflags += [ "-m32", "-Wl,-O3", "-msse3", ]
|
ldflags += [ "-m32", "-Wl,-O3", "-msse3", ]
|
||||||
|
@ -1859,14 +1896,6 @@ config("default_warnings") {
|
||||||
"-Wno-ignored-pragma-optimize",
|
"-Wno-ignored-pragma-optimize",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (llvm_force_head_revision && !is_nacl && enable_precompiled_headers &&
|
|
||||||
!is_win) {
|
|
||||||
cflags += [
|
|
||||||
# TODO(crbug.com/1486799) Find a long-term solution.
|
|
||||||
"-Wno-deprecated-include-gch",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_nacl) {
|
if (!is_nacl) {
|
||||||
cflags += [
|
cflags += [
|
||||||
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
||||||
|
@ -1877,6 +1906,18 @@ config("default_warnings") {
|
||||||
|
|
||||||
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
# TODO(crbug.com/1412713) Evaluate and possibly enable.
|
||||||
"-Wno-deprecated-this-capture",
|
"-Wno-deprecated-this-capture",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1491833): Fix and re-enable.
|
||||||
|
"-Wno-invalid-offsetof",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1494809): Evaluate and possibly enable.
|
||||||
|
"-Wno-vla-extension",
|
||||||
|
|
||||||
|
# TODO(https://crbug.com/1490607): Fix and re-enable.
|
||||||
|
"-Wno-thread-safety-reference-return",
|
||||||
|
|
||||||
|
# TODO(crbug.com/1495100): Evaluate and possibly enable.
|
||||||
|
"-Wno-delayed-template-parsing-in-cxx20",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1977,9 +2018,10 @@ config("chromium_code") {
|
||||||
# disabled, so only do that for Release build.
|
# disabled, so only do that for Release build.
|
||||||
fortify_level = "2"
|
fortify_level = "2"
|
||||||
|
|
||||||
# ChromeOS supports a high-quality _FORTIFY_SOURCE=3 implementation
|
# ChromeOS's toolchain supports a high-quality _FORTIFY_SOURCE=3
|
||||||
# with a few custom glibc patches. Use that if it's available.
|
# implementation with a few custom glibc patches. Use that if it's
|
||||||
if (is_chromeos_ash) {
|
# available.
|
||||||
|
if (is_chromeos_device && !lacros_use_chromium_toolchain) {
|
||||||
fortify_level = "3"
|
fortify_level = "3"
|
||||||
}
|
}
|
||||||
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
|
||||||
|
|
Loading…
Reference in a new issue