--- ./build/config/compiler/BUILD.gn.orig +++ ./build/config/compiler/BUILD.gn @@ -625,13 +625,6 @@ ] } - # The performance improvement does not seem worth the risk. See - # https://crbug.com/484082200 for background and https://crrev.com/c/7593035 - # for discussion. - if (!is_wasm) { - cflags += [ "-fno-lifetime-dse" ] - } - # TODO(hans): Remove this once Clang generates better optimized debug info # by default. https://crbug.com/765793 cflags += [ @@ -646,22 +639,6 @@ } } - # TODO(crbug.com/40283598): This causes binary size growth and potentially - # other problems. - if (default_toolchain != "//build/toolchain/cros:target") { - 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/40192287): Investigate why/if this should be needed. if (is_win) { cflags += [ "/clang:-ffp-contract=off" ] @@ -1339,8 +1316,8 @@ # simplicity we always explicitly set the architecture. if (current_cpu == "x64") { if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device) { - cflags += [ "--target=x86_64-unknown-linux-gnu" ] - ldflags += [ "--target=x86_64-unknown-linux-gnu" ] + cflags += [ "--target=x86_64-alpine-linux-musl" ] + ldflags += [ "--target=x86_64-alpine-linux-musl" ] } else { cflags += [ "-m64" ] ldflags += [ "-m64" ] @@ -1353,8 +1330,8 @@ } } else if (current_cpu == "x86") { if (is_clang && !is_android && !is_chromeos_device) { - cflags += [ "--target=i386-unknown-linux-gnu" ] - ldflags += [ "--target=i386-unknown-linux-gnu" ] + cflags += [ "--target=i586-alpine-linux-musl" ] + ldflags += [ "--target=i586-alpine-linux-musl" ] } else { cflags += [ "-m32" ] ldflags += [ "-m32" ] @@ -1365,8 +1342,8 @@ ] } else if (current_cpu == "arm") { if (is_clang && !is_android && !is_chromeos_device) { - cflags += [ "--target=arm-linux-gnueabihf" ] - ldflags += [ "--target=arm-linux-gnueabihf" ] + cflags += [ "--target=armv7-alpine-linux-musleabihf" ] + ldflags += [ "--target=armv7-alpine-linux-musleabihf" ] } cflags += [ "-march=$arm_arch", @@ -1374,8 +1351,8 @@ ] } else if (current_cpu == "arm64") { if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device) { - cflags += [ "--target=aarch64-linux-gnu" ] - ldflags += [ "--target=aarch64-linux-gnu" ] + cflags += [ "--target=aarch64-alpine-linux-musl" ] + ldflags += [ "--target=aarch64-alpine-linux-musl" ] } if (target_os == "chromeos" && cros_target_cpu_arch != "" && is_a_target_toolchain) { @@ -1624,22 +1601,22 @@ ldflags += [ "-maix64" ] } } else if (is_clang) { - cflags += [ "--target=powerpc64le-unknown-linux-gnu" ] - ldflags += [ "--target=powerpc64le-unknown-linux-gnu" ] + cflags += [ "--target=powerpc64le-alpine-linux-musl" ] + ldflags += [ "--target=powerpc64le-alpine-linux-musl" ] } else { cflags += [ "-m64" ] ldflags += [ "-m64" ] } } else if (current_cpu == "riscv64") { if (is_clang && !is_android) { - cflags += [ "--target=riscv64-linux-gnu" ] - ldflags += [ "--target=riscv64-linux-gnu" ] + cflags += [ "--target=riscv64-alpine-linux-musl" ] + ldflags += [ "--target=riscv64-alpine-linux-musl" ] } cflags += [ "-mabi=lp64d" ] } else if (current_cpu == "loong64") { if (is_clang) { - cflags += [ "--target=loongarch64-linux-gnu" ] - ldflags += [ "--target=loongarch64-linux-gnu" ] + cflags += [ "--target=loongarch64-alpine-linux-musl" ] + ldflags += [ "--target=loongarch64-alpine-linux-musl" ] } cflags += [ "-mabi=lp64d", @@ -1647,8 +1624,8 @@ ] } else if (current_cpu == "s390x") { if (is_clang) { - cflags += [ "--target=s390x-unknown-linux-gnu" ] - ldflags += [ "--target=s390x-unknown-linux-gnu" ] + cflags += [ "--target=s390x-alpine-linux-musl" ] + ldflags += [ "--target=s390x-alpine-linux-musl" ] } cflags += [ "-m64" ] ldflags += [ "-m64" ] @@ -1929,12 +1906,6 @@ cflags = [ "-fsanitize=return", "-fsanitize-trap=return", - - # Some code users feature detection to determine if UBSAN (or any - # sanitizer) is enabled, they then do expensive debug like operations. We - # want to suppress this behaviour since we want to keep performance costs - # as low as possible while having these checks. - "-fsanitize-ignore-for-ubsan-feature=return", ] } } @@ -2432,7 +2403,7 @@ defines = [ "_HAS_NODISCARD" ] } } else { - cflags = [ "-Wall" ] + cflags = [] if (is_clang) { # Enable extra warnings for chromium_code when we control the compiler. cflags += [ "-Wextra" ] --- ./build/config/rust.gni.orig +++ ./build/config/rust.gni @@ -213,11 +213,11 @@ rust_abi_target = "" if (is_linux || is_chromeos) { if (current_cpu == "arm64") { - rust_abi_target = "aarch64-unknown-linux-gnu" + rust_abi_target = "aarch64-alpine-linux-musl" } else if (current_cpu == "x86") { - rust_abi_target = "i686-unknown-linux-gnu" + rust_abi_target = "i586-alpine-linux-musl" } else if (current_cpu == "x64") { - rust_abi_target = "x86_64-unknown-linux-gnu" + rust_abi_target = "x86_64-alpine-linux-musl" } else if (current_cpu == "arm") { if (arm_float_abi == "hard") { float_suffix = "hf" @@ -235,21 +235,21 @@ # The thumbv7 vs. armv7 distinction is for legacy reasons and both # targets in fact target Thumb, see: # https://github.com/rust-lang/rust/issues/44722 - rust_abi_target = "thumbv7neon-unknown-linux-gnueabi" + float_suffix + rust_abi_target = "armv7-alpine-linux-musleabi" + float_suffix } else { - rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix + rust_abi_target = "armv6-alpine-linux-musleabi" + float_suffix } } else if (current_cpu == "riscv64") { - rust_abi_target = "riscv64gc-unknown-linux-gnu" + rust_abi_target = "riscv64-alpine-linux-musl" } else if (current_cpu == "ppc64") { - rust_abi_target = "powerpc64le-unknown-linux-gnu" + rust_abi_target = "powerpc64le-alpine-linux-musl" } else if (current_cpu == "s390x") { - rust_abi_target = "s390x-unknown-linux-gnu" + rust_abi_target = "s390x-alpine-linux-musl" } else if (current_cpu == "loong64") { - rust_abi_target = "loongarch64-unknown-linux-gnu" + rust_abi_target = "loongarch64-alpine-linux-musl" } else { # Best guess for other future platforms. - rust_abi_target = current_cpu + "-unknown-linux-gnu" + rust_abi_target = current_cpu + "-alpine-linux-musl" } } else if (is_android) { import("//build/config/android/abi.gni") --- ./build/config/clang/BUILD.gn.orig +++ ./build/config/clang/BUILD.gn @@ -207,22 +207,23 @@ assert(false) # Unhandled cpu type } } else if (is_linux || is_chromeos) { + _dir = "linux" if (current_cpu == "x64") { - _dir = "x86_64-unknown-linux-gnu" + _suffix = "-x86_64" } else if (current_cpu == "x86") { - _dir = "i386-unknown-linux-gnu" + _suffix = "-i386" } else if (current_cpu == "arm") { - _dir = "armv7-unknown-linux-gnueabihf" + _suffix = "-armhf" } else if (current_cpu == "arm64") { - _dir = "aarch64-unknown-linux-gnu" + _suffix = "-aarch64" } else if (current_cpu == "loong64") { - _dir = "loongarch64-unknown-linux-gnu" + _suffix = "-loongarch64" } else if (current_cpu == "riscv64") { - _dir = "riscv64-unknown-linux-gnu" + _suffix = "-riscv64" } else if (current_cpu == "ppc64") { - _dir = "ppc64le-unknown-linux-gnu" + _suffix = "-powerpc64le" } else if (current_cpu == "s390x") { - _dir = "s390x-unknown-linux-gnu" + _suffix = "-s390x" } else { assert(false) # Unhandled cpu type }