--- testing/test.gni 2025-09-29 14:44:53.000000000 +0800 +++ testing/test.gni 2025-11-03 22:15:07.000000000 +0800 @@ -11,7 +11,6 @@ import("//build/config/devtools.gni") import("//build/config/gclient_args.gni") import("//build/config/rts.gni") -import("//build/rust/rust_static_library.gni") import("//build_overrides/build.gni") declare_args() { --- build/config/BUILDCONFIG.gn 2025-09-27 12:42:34.000000000 +0800 +++ build/config/BUILDCONFIG.gn 2025-11-03 22:28:25.000000000 +0800 @@ -368,8 +368,6 @@ "//build/config/compiler:thin_archive", "//build/config/compiler:thinlto_optimize_default", "//build/config/compiler:tot_warnings", - "//build/config/coverage:default_coverage", - "//build/config/sanitizers:default_sanitizer_flags", "//build/config:feature_flags", ] --- build/config/BUILD.gn 2025-09-27 12:42:34.000000000 +0800 +++ build/config/BUILD.gn 2025-11-03 22:27:19.000000000 +0800 @@ -16,8 +16,6 @@ import("//build/config/mac/mac_sdk_overrides.gni") import("//build/config/pch.gni") -import("//build/config/rust.gni") -import("//build/config/sanitizers/sanitizers.gni") import("//build/config/ui.gni") if (is_android) { import("//build/config/android/abi.gni") --- build/toolchain/apple/toolchain.gni 2026-01-10 15:07:30.000000000 +0800 +++ build/toolchain/apple/toolchain.gni 2026-03-02 00:17:34.000000000 +0800 @@ -11,7 +11,6 @@ import("//build/config/clang/clang.gni") import("//build/config/compiler/compiler.gni") import("//build/config/coverage/coverage.gni") -import("//build/config/rust.gni") import("//build/toolchain/cc_wrapper.gni") import("//build/toolchain/rbe.gni") import("//build/toolchain/toolchain.gni") @@ -303,234 +302,10 @@ md = "-MMD" } - if (toolchain_has_rust) { - rustc_wrapper_path = - rebase_path("//build/rust/gni_impl/rustc_wrapper.py", root_build_dir) - rustc_wrapper = "\"$python_path\" \"$rustc_wrapper_path\"" - - rustc_env_and_flags_path = - "{{target_out_dir}}/{{label_name}}.rustflags.json" - rustc_wrapper += " --dump-rustc-env-and-flags $rustc_env_and_flags_path" - - rustc_rsp_path = "{{target_out_dir}}/{{label_name}}.rsp" - rustc_wrapper += " --rsp=$rustc_rsp_path" - - if (!defined(rust_compiler_prefix)) { - rust_compiler_prefix = "" - } - rust_sysroot_relative = rebase_path(rust_sysroot, root_build_dir) - rustc_bin = "$rust_sysroot_relative/bin/rustc" - rustc = "$rust_compiler_prefix${rustc_bin}" - rustc_wrapper += " --rustc=$rustc" - - tool("rust_staticlib") { - libname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = rustc_rsp_path - depfile = "$libname.d" - - default_output_extension = ".a" - output_prefix = "lib" - - # Static libraries go in the target out directory by default so we can - # generate different targets with the same name and not have them - # collide. - default_output_dir = "{{target_out_dir}}" - description = "RUST(STATICLIB) {{output}}" - outputs = [ - libname, - rustc_env_and_flags_path, - "${rspfile}.rust", - ] - - # TODO(danakj): When `!toolchain_uses_lld` do we need to specify a path - # to libtool like the "alink" rule? - - rspfile_content = - "$rustc_common_args {{rustdeps}} {{externs}} SOURCES {{sources}}" - command = "$rustc_wrapper --depfile=$depfile --emit=dep-info=$depfile,link -o $libname -- -Clinker=\"$_cxx\" {{source}} LDFLAGS $bin_flag RUSTENV {{rustenv}}" - rust_sysroot = rust_sysroot_relative - inputs = rustc_wrapper_inputs - } - - tool("rust_rlib") { - # We must always prefix with `lib` even if the library already starts - # with that prefix or else our stdlib is unable to find libc.rlib (or - # actually liblibc.rlib). - rlibname = - "{{output_dir}}/lib{{target_output_name}}{{output_extension}}" - rspfile = rustc_rsp_path - depfile = "$rlibname.d" - rmetaname = "{{output_dir}}/lib{{target_output_name}}.rmeta" - - default_output_extension = ".rlib" - - # This is prefixed unconditionally in `rlibname`. - # output_prefix = "lib" - - # Static libraries go in the target out directory by default so we can - # generate different targets with the same name and not have them - # collide. - default_output_dir = "{{target_out_dir}}" - description = "RUST {{output}}" - outputs = [ - rlibname, - rmetaname, - rustc_env_and_flags_path, - "${rspfile}.rust", - ] - - rspfile_content = - "$rustc_common_args {{rustdeps}} {{externs}} SOURCES {{sources}}" - command = "$rustc_wrapper --depfile=$depfile --emit=dep-info=$depfile,link,metadata=$rmetaname -o $rlibname -- -Clinker=\"$_cxx\" {{source}} LDFLAGS RUSTENV {{rustenv}}" - rust_sysroot = rust_sysroot_relative - inputs = rustc_wrapper_inputs - } - - tool("rust_bin") { - exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = rustc_rsp_path - depfile = "$exename.d" - pool = "//build/toolchain:link_pool($default_toolchain)" - - # TODO(danakj): solink can generate TOC files for re-exporting library - # symbols, and we should do the same here. - - default_output_dir = "{{root_out_dir}}" - description = "RUST(BIN) {{output}}" - outputs = [ - exename, - rustc_env_and_flags_path, - "${rspfile}.rust", - ] - - # TODO(danakj): Support dsym_switch like C++ targets. - # link_command += dsym_switch - # if (_enable_dsyms) { - # outputs += dsym_output - # } - # if (_save_unstripped_output) { - # outputs += [ _unstripped_output ] - # } - - rspfile_content = - "$rustc_common_args {{rustdeps}} {{externs}} SOURCES {{sources}}" - command = "$linker_driver_env $rustc_wrapper --depfile=$depfile --emit=dep-info=$depfile,link -o $exename -- -Clinker=\"$linker_driver\" {{source}} LDFLAGS $linker_driver_args $bin_flag {{ldflags}} RUSTENV {{rustenv}}" - rust_sysroot = rust_sysroot_relative - inputs = rustc_wrapper_inputs - } - - tool("rust_cdylib") { - dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = rustc_rsp_path - depfile = "$dllname.d" - pool = "//build/toolchain:link_pool($default_toolchain)" - - # TODO(danakj): solink can generate TOC files for re-exporting library - # symbols, and we should do the same here. - - default_output_extension = ".dylib" - output_prefix = "lib" - default_output_dir = "{{root_out_dir}}" - description = "RUST(CDYLIB) {{output}}" - outputs = [ - dllname, - rustc_env_and_flags_path, - "${rspfile}.rust", - ] - - # TODO(danakj): Support dsym_switch like C++ targets. - # link_command += dsym_switch - # if (_enable_dsyms) { - # outputs += dsym_output - # } - # if (_save_unstripped_output) { - # outputs += [ _unstripped_output ] - # } - - rspfile_content = - "$rustc_common_args {{rustdeps}} {{externs}} SOURCES {{sources}}" - command = "$linker_driver_env $rustc_wrapper --depfile=$depfile --emit=dep-info=$depfile,link -o $dllname -- -Clinker=\"$linker_driver\" {{source}} LDFLAGS $linker_driver_args $bin_flag {{ldflags}} RUSTENV {{rustenv}}" - rust_sysroot = rust_sysroot_relative - inputs = rustc_wrapper_inputs - } - - tool("rust_dylib") { - dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = rustc_rsp_path - depfile = "$dllname.d" - pool = "//build/toolchain:link_pool($default_toolchain)" - rmetaname = "{{output_dir}}/lib{{target_output_name}}.rmeta" - - # TODO(danakj): solink can generate TOC files for re-exporting library - # symbols, and we should do the same here. - - default_output_extension = ".dylib" - output_prefix = "lib" - default_output_dir = "{{root_out_dir}}" - description = "RUST(DYLIB) {{output}}" - outputs = [ - dllname, - rmetaname, - rustc_env_and_flags_path, - "${rspfile}.rust", - ] - - # TODO(danakj): Support dsym_switch like C++ targets. - # link_command += dsym_switch - # if (_enable_dsyms) { - # outputs += dsym_output - # } - # if (_save_unstripped_output) { - # outputs += [ _unstripped_output ] - # } - - rspfile_content = - "$rustc_common_args {{rustdeps}} {{externs}} SOURCES {{sources}}" - command = "$linker_driver_env $rustc_wrapper --depfile=$depfile --emit=dep-info=$depfile,link,metadata=$rmetaname -o $dllname -- -Clinker=\"$linker_driver\" {{source}} LDFLAGS $linker_driver_args {{ldflags}} RUSTENV {{rustenv}}" - rust_sysroot = rust_sysroot_relative - inputs = rustc_wrapper_inputs - } - - tool("rust_macro") { - dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = rustc_rsp_path - depfile = "$dllname.d" - pool = "//build/toolchain:link_pool($default_toolchain)" - - # TODO(danakj): solink can generate TOC files for re-exporting library - # symbols, and we should do the same here. - - default_output_extension = ".dylib" - output_prefix = "lib" - default_output_dir = "{{root_out_dir}}" - description = "RUST(MACRO) {{output}}" - outputs = [ - dllname, - rustc_env_and_flags_path, - "${rspfile}.rust", - ] - - # TODO(danakj): Support dsym_switch like C++ targets. - # link_command += dsym_switch - # if (_enable_dsyms) { - # outputs += dsym_output - # } - # if (_save_unstripped_output) { - # outputs += [ _unstripped_output ] - # } - - rspfile_content = - "$rustc_common_args {{rustdeps}} {{externs}} SOURCES {{sources}}" - command = "$rustc_wrapper --depfile=$depfile --emit=dep-info=$depfile,link -o $dllname -- -Clinker=\"${_cxx}\" {{source}} LDFLAGS $bin_flag {{ldflags}} RUSTENV {{rustenv}}" - rust_sysroot = rust_sysroot_relative - inputs = rustc_wrapper_inputs - } - } - tool("cc") { depfile = "{{output}}.d" precompiled_header_type = "gcc" - command = "$coverage_wrapper$cc $md -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -fmodule-name=\"{{cc_module_name}}_Private\" -c {{source}} -o {{output}}" + command = "$coverage_wrapper$cc $md -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" depsformat = "gcc" description = "CC {{output}}" outputs = [ "$object_subdir/{{source_name_part}}.o" ] @@ -540,7 +315,7 @@ depfile = "{{output}}.d" precompiled_header_type = "gcc" - command = "$coverage_wrapper$cxx $md -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{module_deps}} -fmodule-name=\"{{cc_module_name}}_Private\" -c {{source}} -o {{output}}" + command = "$coverage_wrapper$cxx $md -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{module_deps}} -c {{source}} -o {{output}}" depsformat = "gcc" description = "CXX {{output}}" outputs = [ "$object_subdir/{{source_name_part}}.o" ] --- build/config/compiler/BUILD.gn 2025-10-27 10:09:40.000000000 +0800 +++ build/config/compiler/BUILD.gn 2026-03-27 13:44:45.000000000 +0800 @@ -17,7 +17,6 @@ import("//build/config/gclient_args.gni") import("//build/config/host_byteorder.gni") import("//build/config/pch.gni") -import("//build/config/rust.gni") import("//build/config/sanitizers/sanitizers.gni") import("//build/config/ui.gni") import("//build/config/unwind.gni") @@ -122,7 +121,7 @@ # 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 || is_android || is_win || is_linux || is_mac || + (is_chromeos || is_android || is_win || is_linux || (is_ios && use_lld)) && is_official_build # Whether to enable thin lto incremental builds. @@ -368,7 +367,6 @@ configs += [ # See the definitions below. ":clang_revision", - ":rustc_revision", ":compiler_cpu_abi", ":compiler_codegen", ":compiler_deterministic", @@ -527,6 +525,10 @@ cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ] } + if (current_cpu == "ppc" || current_cpu == "ppc64") { + cflags_cc += [ "-D_GLIBCXX_USE_CXX11_ABI=0" ] + } + # dsymutil is not available in the system, on bots, for rustc to call. Our # linker_driver.py script runs dsymutil itself, which is set to be the # linker for Rust targets as well. @@ -989,9 +991,6 @@ # sequences, ignoring the platform, when stderr is not a terminal. rustflags += [ "--color=always" ] } - if (rust_abi_target != "") { - rustflags += [ "--target=$rust_abi_target" ] - } if (!use_thin_lto || !toolchain_supports_rust_thin_lto) { # Don't include bitcode if it won't be used. rustflags += [ "-Cembed-bitcode=no" ] @@ -1004,29 +1003,6 @@ if (is_official_build) { rustflags += [ "-Ccodegen-units=1" ] } - if (!rust_prebuilt_stdlib) { - # When building against the Chromium Rust stdlib (which we compile) always - # abort instead of unwinding when panic occurs. In official builds, panics - # abort immediately (this is configured in the stdlib) to keep binary size - # down. So we unconditionally match behaviour in unofficial too. - # AOSP does not allow the usage of unstable features. This means that - # we can't enable `immediate-abort` when building cronet in AOSP until - # it has been stabilized. - # - # TODO(crbug.com/447558108): Use immediate-abort in AOSP once stabilized. - if (is_official_build && !is_cronet_for_aosp_build) { - rustflags += [ - "-Zunstable-options", - "-Cpanic=immediate-abort", - "-Zpanic_abort_tests", - ] - } else { - rustflags += [ - "-Cpanic=abort", - "-Zpanic_abort_tests", - ] - } - } # 64-bit Android sometimes defines __ARM_NEON but not __ARM_NEON__. # 32-bit Android builds and macOS, however, define __ARM_NEON__, @@ -1813,26 +1789,6 @@ "clang_revision=\"$_clang_revision\" but clang_version=\"$clang_version\". clang_version in build/toolchain/toolchain.gni is likely outdated.") } - if (toolchain_has_rust && _perform_consistency_checks && - !rust_force_head_revision) { - # Ensure that the synced rust version matches what's in git. - _rust_revision_lines = - filter_include(read_file("//tools/rust/update_rust.py", "list lines"), - [ "RUST_*REVISION = *" ]) - _py_revision = - string_replace(_rust_revision_lines[0], "RUST_REVISION = '", "") - _py_revision = string_replace(_py_revision, "'", "") - _py_subrevision = - string_replace(_rust_revision_lines[1], "RUST_SUB_REVISION = ", "") - _expected_rust_revision = "$_py_revision-$_py_subrevision" - - # Ensure the rust version matches the clang version. - assert( - filter_include([ rustc_revision ], - [ "*-$_expected_rust_revision-*" ]) != [], - "rustc_revision=\"$rustc_revision\" but update_rust.py expected \"$_expected_rust_revision\". Run \"gclient sync\"?") - } - # This is here so that all files get recompiled after a clang roll and # when turning clang on or off. (defines are passed via the command line, # and build system rebuild things when their commandline changes). Nothing @@ -1896,18 +1852,6 @@ } } -config("rustc_revision") { - if (rustc_revision != "") { - # Similar to the `clang_revision` config, this is here so that all `.rs` - # sources get recompiled after a rustc roll. Nothing should ever read this - # cfg. This will not be set if a custom toolchain is used. - rustflags = [ - "--cfg", - "cr_rustc_revision=\"$rustc_revision\"", - ] - } -} - config("compiler_arm_fpu") { if (current_cpu == "arm" && !is_ios) { cflags = [ "-mfpu=neon" ] @@ -2132,7 +2076,7 @@ cflags += [ "/wd4244" ] } } else { - if (is_apple || is_android) { + if (is_android) { # Warns if a method is used whose availability is newer than the # deployment target. cflags += [ "-Wunguarded-availability" ] @@ -2425,14 +2369,9 @@ defines += [ "_FORTIFY_SOURCE=" + fortify_level ] } - if (is_apple) { - cflags_objc = [ "-Wimplicit-retain-self" ] - cflags_objcc = [ "-Wimplicit-retain-self" ] - } - - if (is_mac) { - cflags_objc += [ "-Wobjc-missing-property-synthesis" ] - cflags_objcc += [ "-Wobjc-missing-property-synthesis" ] + if (is_clang) { + cflags_objc = [ "-Wimplicit-retain-self", "-Wobjc-missing-property-synthesis" ] + cflags_objcc = [ "-Wimplicit-retain-self", "-Wobjc-missing-property-synthesis" ] } if (is_ios) { --- build/toolchain/mac/BUILD.gn 2025-09-27 12:42:34.000000000 +0800 +++ build/toolchain/mac/BUILD.gn 2025-12-14 18:52:40.000000000 +0800 @@ -58,6 +58,18 @@ } } +mac_toolchain("clang_ppc") { + toolchain_args = { + current_cpu = "ppc" + } +} + +mac_toolchain("clang_ppc64") { + toolchain_args = { + current_cpu = "ppc64" + } +} + mac_toolchain("clang_x64") { toolchain_args = { current_cpu = "x64" --- build/config/apple/apple_sdk.gni 2026-06-29 09:24:23.000000000 +0800 +++ build/config/apple/apple_sdk.gni 2026-07-26 00:28:44.000000000 +0800 @@ -9,7 +9,7 @@ } else if (is_mac) { import("//build/config/mac/mac_sdk.gni") sdk_path = mac_sdk_path - use_xcode_symlinks = use_system_xcode + use_xcode_symlinks = mac_use_xcode_symlinks } else { use_xcode_symlinks = false } --- build/config/mac/BUILD.gn 2026-06-29 09:24:23.000000000 +0800 +++ build/config/mac/BUILD.gn 2026-07-26 00:31:28.000000000 +0800 @@ -17,14 +17,15 @@ common_mac_flags = [] # CPU architecture. - if (defined(archs_mapping[current_os])) { - _archs_mapping_os = archs_mapping[current_os] - if (defined(_archs_mapping_os[current_cpu])) { - _archs_mapping_os_cpu = _archs_mapping_os[current_cpu] - clang_arch = _archs_mapping_os_cpu.clang_arch - common_mac_flags += [ "--target=$clang_arch-apple-macos" ] - } + _archs_mapping_os = archs_mapping[current_os] + if (defined(_archs_mapping_os[current_cpu])) { + _archs_mapping_os_cpu = _archs_mapping_os[current_cpu] + clang_arch = _archs_mapping_os_cpu.clang_arch + } else { + notneeded([ "_archs_mapping_os" ]) + assert(false, "unknown current_cpu $current_cpu") } + common_mac_flags += [ "-arch", "$clang_arch" ] # This is here so that all files get recompiled after an Xcode update. # (defines are passed via the command line, and build system rebuild things @@ -53,7 +54,7 @@ common_flags = [ "-isysroot", rebase_path(sysroot, root_build_dir), - "-mmacos-version-min=$mac_deployment_target", + "-mmacosx-version-min=$mac_deployment_target", ] asmflags = common_flags @@ -102,7 +103,7 @@ # # The symbolic link for $mac_sdk_path is set up by # //build/config/apple/sdk_info.py in //build/config/mac/mac_sdk.gni. -if (use_system_xcode && current_toolchain == default_toolchain) { +if (mac_use_xcode_symlinks && current_toolchain == default_toolchain) { action("sdk_inputs") { script = "//build/noop.py" outputs = [ @@ -113,7 +114,7 @@ } } else { group("sdk_inputs") { - if (current_toolchain != default_toolchain && (is_mac || is_ios)) { + if (current_toolchain != default_toolchain && target_os == "ios") { public_deps = [ ":sdk_inputs($default_toolchain)" ] } } --- build/config/mac/mac_sdk.gni 2026-06-29 09:24:23.000000000 +0800 +++ build/config/mac/mac_sdk.gni 2026-07-26 00:33:29.000000000 +0800 @@ -92,9 +92,35 @@ ] } +# Building crashpard requires some files that are part of the macOS SDK +# (and shipped inside Xcode.app) into the application. When using the +# system installation of Xcode, those files are outside of the checkout. +# Using absolute path works with gn, however the distributed build system +# requires that all paths are relative to the checkout. This is faked by +# using symbolic links to the SDK inside of Xcode. Additionally, each build +# directory may use a distinct version of Xcode (e.g. to build with beta), +# so the symlink needs to be present in the $root_build_dir. However, when +# doing that, we need to list inputs pointing to file in $root_build_dir, +# and gn requires all files in $root_build_dir to be listed as outputs of +# another target. +# +# To fulfill all of those requirements, we 1. create symlinks pointing to +# the SDK files in Xcode, 2. declare a target listing the files as outputs +# (the target is a script that does nothing, it only pretends to create +# the files but they already exists). +# +# This works, but results in some files in $root_build_dir being links to +# files outside of the build directory. Running `ninja -t clean` will try +# to delete those files breaking Xcode installation. The recommendation is +# to use `gn clean` or `ninja -t cleandead` instead. +# +# This variable controls whether we create the symlink and the workaround +# is needed or not. See https://crbug.com/336382863#comment16 for details. +mac_use_xcode_symlinks = use_system_xcode && use_remoteexec + # RBE requires paths relative to source directory. When using system # Xcode, this is done by creating symbolic links in root_build_dir. -if (use_system_xcode) { +if (mac_use_xcode_symlinks) { sdk_info_args += [ "--get_sdk_info", "--create_symlink_at", @@ -109,7 +135,7 @@ xcode_version = _mac_sdk_result.xcode_version xcode_version_int = _mac_sdk_result.xcode_version_int xcode_build = _mac_sdk_result.xcode_build -if (mac_sdk_path == "" && use_system_xcode) { +if (mac_sdk_path == "" && use_system_xcode && use_remoteexec) { mac_sdk_path = _mac_sdk_result.sdk_path } --- build/config/apple/arch.gni 2025-10-27 15:48:33.000000000 +0800 +++ build/config/apple/arch.gni 2025-12-18 03:46:24.000000000 +0800 @@ -35,6 +35,16 @@ dsym_arch = "aarch64" } + ppc = { + clang_arch = "ppc" + dsym_arch = "ppc" + } + + ppc64 = { + clang_arch = "ppc64" + dsym_arch = "ppc64" + } + x64 = { clang_arch = "x86_64" dsym_arch = "x86_64"