From 43186fe909a92362a2f978bc09494e4b1986a5c1 Mon Sep 17 00:00:00 2001 From: Alexander David Frick Date: Fri, 17 Jun 2022 07:31:37 -0700 Subject: [PATCH] Update BUILD.gn --- build/config/compiler/BUILD.gn | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 2efb0dae..e9aa3eb6 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -267,9 +267,6 @@ config("compiler") { configs += [ "//build/config/android:compiler" ] } else if (is_linux || is_chromeos) { configs += [ "//build/config/linux:compiler" ] - if (is_chromeos) { - configs += [ "//build/config/chromeos:compiler" ] - } } else if (is_nacl) { configs += [ "//build/config/nacl:compiler" ] } else if (is_mac) { @@ -661,7 +658,7 @@ config("compiler") { # binary size than the default setting of 100. # TODO(gbiv): We ideally shouldn't need to specify this; ThinLTO # should be able to better manage binary size increases on its own. - import_instr_limit = 40 + import_instr_limit = 30 if (is_win) { ldflags += [ @@ -892,6 +889,11 @@ config("compiler_cpu_abi") { cflags = [ "-O3", ] ldflags = [] defines = [] + + configs = [] + if (is_chromeos) { + configs += [ "//build/config/chromeos:compiler_cpu_abi" ] + } if ((is_posix && !is_apple) || is_fuchsia) { # CPU architecture. We may or may not be doing a cross compile now, so for @@ -903,7 +905,7 @@ config("compiler_cpu_abi") { "-mavx", "-maes", ] - ldflags += [ "-m64", "-Wl,-O3", "-mavx", "-maes", "-Wl,-mllvm,-import-instr-limit=40", "-Wl,-mllvm,-import-hot-multiplier=30", "-Wl,-mllvm,-import-cold-multiplier=8", ] + ldflags += [ "-m64", "-Wl,-O3", "-mavx", "-maes", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=30", "-Wl,-mllvm,-import-cold-multiplier=8", ] } else if (current_cpu == "x86") { cflags += [ "-m32" ] ldflags += [ "-m32" ] @@ -920,7 +922,8 @@ config("compiler_cpu_abi") { ldflags += [ "-Wno-unused-command-line-argument", ] } } 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)) { cflags += [ "--target=arm-linux-gnueabihf", "-O3", "-Wno-unused-command-line-argument", ] ldflags += [ "--target=arm-linux-gnueabihf", "-Wl,-O3", "-Wno-unused-command-line-argument", ] } @@ -934,7 +937,8 @@ config("compiler_cpu_abi") { cflags += [ "-mtune=$arm_tune" ] } } else if (current_cpu == "arm64") { - if (is_clang && !is_android && !is_nacl && !is_fuchsia) { + if (is_clang && !is_android && !is_nacl && !is_fuchsia && + !(is_chromeos_lacros && is_chromeos_device)) { cflags += [ "--target=aarch64-linux-gnu", "-O3", "-Wno-unused-command-line-argument", ] ldflags += [ "--target=aarch64-linux-gnu", "-Wl,-O3", "-Wno-unused-command-line-argument", ] } @@ -1183,6 +1187,14 @@ config("compiler_cpu_abi") { cflags += [ "-m64" ] ldflags += [ "-m64" ] } + } else if (current_cpu == "riscv64") { + cflags += [ + "-mabi=lp64d", + "--target=riscv64-linux-gnu", + ] + ldflags += [ + "--target=riscv64-linux-gnu", + ] } else if (current_cpu == "s390x") { cflags += [ "-m64" ] ldflags += [ "-m64" ] @@ -1651,7 +1663,8 @@ config("chromium_code") { if (!is_debug && !using_sanitizer && current_cpu != "s390x" && current_cpu != "s390" && current_cpu != "ppc64" && - current_cpu != "mips" && current_cpu != "mips64") { + current_cpu != "mips" && current_cpu != "mips64" && + current_cpu != "riscv64") { # Non-chromium code is not guaranteed to compile cleanly with # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are # disabled, so only do that for Release build. @@ -2320,9 +2333,9 @@ if (is_clang && is_a_target_toolchain) { } else if (clang_use_default_sample_profile) { assert(build_with_chromium, "Our default profiles currently only apply to Chromium") - assert(is_android || is_chromeos || is_chromecast, + assert(is_android || is_chromeos || is_castos, "The current platform has no default profile") - if (is_android || is_chromecast) { + if (is_android || is_castos) { _clang_sample_profile = "//chrome/android/profiles/afdo.prof" } else { assert(chromeos_afdo_platform == "atom" ||