From 00a79dac63e869fbd81f082b39b7c6e226bef395 Mon Sep 17 00:00:00 2001 From: Alexander David Frick Date: Thu, 16 Dec 2021 06:20:03 -0600 Subject: [PATCH] Update BUILD.gn --- build/config/compiler/BUILD.gn | 44 ++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 7894edae..e8312419 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -129,8 +129,8 @@ declare_args() { # TODO(gbiv): We disable optimizations by default on most platforms because # the space overhead is too great. We should use some mixture of profiles and # optimization settings to better tune the size increase. - thin_lto_enable_optimizations = - (is_chromeos_ash || is_android || is_win || is_linux) && is_official_build + thin_lto_enable_optimizations = (is_chromeos_ash || is_android || is_win || + is_linux || is_mac) && is_official_build # Initialize all local variables with a pattern. This flag will fill # uninitialized floating-point types (and 32-bit pointers) with 0xFF and the @@ -586,7 +586,6 @@ config("compiler") { } cflags_c += [ "-std=${standard_prefix}11" ] - if (is_nacl && !is_nacl_saigo) { # This is for the pnacl_newlib toolchain. It's only used to build # a few independent ppapi test files that don't pull in any other @@ -655,10 +654,11 @@ config("compiler") { if (!is_debug && use_thin_lto && is_a_target_toolchain) { assert(use_lld, "LTO is only supported with lld") - cflags += [ - "-flto=thin", - "-fsplit-lto-unit", - ] + cflags += [ "-flto=thin" ] + if (!is_mac) { + # TODO(lgrey): Enable unit splitting for Mac when supported. + cflags += [ "-fsplit-lto-unit" ] + } # Limit the size of the ThinLTO cache to the lesser of 10% of # available disk space, 40GB and 100000 files. @@ -673,7 +673,7 @@ config("compiler") { "/opt:lldltojobs=all", "-mllvm:-import-instr-limit=$import_instr_limit", # "/lldltocache:" + - # rebase_path("$root_out_dir/thinlto-cache", root_build_dir), + # rebase_path("$root_out_dir/thinlto-cache", root_build_dir), # "/lldltocachepolicy:$cache_policy", ] } else { @@ -692,6 +692,10 @@ config("compiler") { ldflags += [ "-Wl,-cache_path_lto," + rebase_path("$root_out_dir/thinlto-cache", root_build_dir) ] + } else { + ldflags += + # [ "-Wl,--thinlto-cache-dir=" + + # rebase_path("$root_out_dir/thinlto-cache", root_build_dir) ] } # ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ] @@ -1911,16 +1915,16 @@ if (is_win) { ] common_optimize_on_ldflags += [ - "-mllvm:-extra-vectorizer-passes", - "-mllvm:-enable-cond-stores-vec", - "-mllvm:-slp-vectorize-hor-store", - "-mllvm:-enable-loopinterchange", - "-mllvm:-enable-loop-distribute", - "-mllvm:-enable-unroll-and-jam", - "-mllvm:-enable-loop-flatten", - "-mllvm:-interleave-small-loop-scalar-reduction", - "-mllvm:-unroll-runtime-multi-exit", - "-mllvm:-aggressive-ext-opt", + "-Wl,-mllvm,-extra-vectorizer-passes", + "-Wl,-mllvm,-enable-cond-stores-vec", + "-Wl,-mllvm,-slp-vectorize-hor-store", + "-Wl,-mllvm,-enable-loopinterchange", + "-Wl,-mllvm,-enable-loop-distribute", + "-Wl,-mllvm,-enable-unroll-and-jam", + "-Wl,-mllvm,-enable-loop-flatten", + "-Wl,-mllvm,-interleave-small-loop-scalar-reduction", + "-Wl,-mllvm,-unroll-runtime-multi-exit", + "-Wl,-mllvm,-aggressive-ext-opt", ] # /OPT:ICF is not desirable in Debug builds, since code-folding can result in @@ -1936,7 +1940,7 @@ if (is_win) { } else { common_optimize_on_cflags = [] common_optimize_on_ldflags = [] - + common_optimize_on_cflags += [ "-mllvm", "-extra-vectorizer-passes", "-mllvm", "-enable-cond-stores-vec", @@ -2175,7 +2179,7 @@ config("optimize_speed") { config("optimize_fuzzing") { cflags = [ "-O1" ] + common_optimize_on_cflags - rustflags = [ "-Copt-level=1" ] + rustflags = [ "-Copt-level=3" ] ldflags = common_optimize_on_ldflags visibility = [ ":default_optimization" ] }