--- ./build/config/compiler/BUILD.gn.orig +++ ./build/config/compiler/BUILD.gn @@ -658,22 +658,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" ] @@ -1273,8 +1257,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" ] @@ -1282,8 +1266,8 @@ cflags += [ "-msse3" ] } 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" ] @@ -1294,8 +1278,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", @@ -1306,8 +1290,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" ] } } else if (current_cpu == "mipsel") { ldflags += [ "-Wl,--hash-style=sysv" ] @@ -1551,22 +1535,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", @@ -1574,8 +1558,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" ] @@ -2274,7 +2258,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 @@ -178,11 +178,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" @@ -200,25 +200,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 - if (arm_use_neon) { - rust_abi_target = "thumbv7neon-unknown-linux-gnueabi" + float_suffix - } else { - rust_abi_target = "armv7-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 }