diff --git a/arm/build/config/compiler/BUILD.gn b/arm/build/config/compiler/BUILD.gn index d29db275..5dc8487a 100644 --- a/arm/build/config/compiler/BUILD.gn +++ b/arm/build/config/compiler/BUILD.gn @@ -85,9 +85,6 @@ declare_args() { # the needed gcov profiling data. auto_profile_path = "" - # Allow projects that wish to stay on C++11 to override Chromium's default. - use_cxx11 = false - # Path to an AFDO profile to use while building with clang, if any. Empty # implies none. clang_sample_profile_path = "" @@ -600,6 +597,15 @@ 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 { + # 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 { cflags_cc += [ "-std=${standard_prefix}++17" ] } @@ -613,7 +619,12 @@ config("compiler") { # turned off we need the !is_nacl clause and the (is_nacl && is_clang) # clause, above. cflags_c += [ "-std=c11" ] - cflags_cc += [ "-std=c++17" ] + if (is_apple) { + # TODO(crbug.com/1284275): Switch to C++20 on all platforms. + cflags_cc += [ "-std=c++20" ] + } else { + cflags_cc += [ "-std=c++17" ] + } } if (is_clang && current_os != "zos") { @@ -745,6 +756,12 @@ config("compiler") { ldflags += [ "-Wl,--no-rosegment" ] } + # TODO(crbug.com/1374347): Cleanup undefined symbol errors caught by + # --no-undefined-version. + if (use_lld && !is_win && !is_mac && !is_ios) { + ldflags += [ "-Wl,--undefined-version" ] + } + # LLD does call-graph-sorted binary layout by default when profile data is # present. On Android this increases binary size due to more thinks for long # jumps. Turn it off by default and enable selectively for targets where it's @@ -1198,6 +1215,15 @@ config("compiler_cpu_abi") { ldflags += [ "--target=riscv64-linux-gnu" ] } cflags += [ "-mabi=lp64d" ] + } else if (current_cpu == "loong64") { + if (is_clang) { + cflags += [ "--target=loongarch64-linux-gnu" ] + ldflags += [ "--target=loongarch64-linux-gnu" ] + } + cflags += [ + "-mabi=lp64d", + "-mcmodel=medium", + ] } else if (current_cpu == "s390x") { cflags += [ "-m64" ] ldflags += [ "-m64" ] @@ -1243,6 +1269,7 @@ config("compiler_codegen") { config("compiler_deterministic") { cflags = [] ldflags = [] + swiftflags = [] # Eliminate build metadata (__DATE__, __TIME__ and __TIMESTAMP__) for # deterministic build. See https://crbug.com/314403 @@ -1283,6 +1310,7 @@ config("compiler_deterministic") { # -ffile-compilation-dir is an alias for both -fdebug-compilation-dir= # and -fcoverage-compilation-dir=. cflags += [ "-ffile-compilation-dir=." ] + swiftflags += [ "-file-compilation-dir=." ] } if (!is_win) { # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167) @@ -1529,6 +1557,16 @@ config("default_warnings") { ] } + if (!is_nacl || is_nacl_saigo) { + cflags += [ + # An ABI compat warning we don't care about, https://crbug.com/1102157 + # TODO(thakis): Push this to the (few) targets that need it, + # instead of having a global flag. + "-Wno-psabi", + ] + } + } + if (is_clang) { cflags += [ "-Wloop-analysis", @@ -1549,11 +1587,6 @@ config("default_warnings") { cflags += [ "-Wenum-compare-conditional", - # An ABI compat warning we don't care about, https://crbug.com/1102157 - # TODO(thakis): Push this to the (few) targets that need it, - # instead of having a global flag. - "-Wno-psabi", - # Ignore warnings about MSVC optimization pragmas. # TODO(thakis): Only for no_chromium_code? http://crbug.com/912662 "-Wno-ignored-pragma-optimize", @@ -1652,7 +1685,7 @@ 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 != "riscv64") { + current_cpu != "riscv64" && current_cpu != "loong64") { # 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. @@ -2428,7 +2461,7 @@ config("symbols") { # Compress debug on 32-bit ARM to stay under 4GB for ChromeOS # https://b/243982712. if (symbol_level == 2 && is_chromeos_device && !use_debug_fission && - !is_nacl && current_cpu == "arm") { + !is_nacl && current_cpu == "arm") { configs += [ "//build/config:compress_debug_sections" ] }