Skip to content

Commit ab552cc

Browse files
danakjcopybara-github
authored andcommitted
Turn off is_official_build in the Rust Host Build Tools toolchain
Tools built to be used during the build process don't need PGO and other official build things. This works around a bug on Mac for chrome.exe where Rust gives the linker -plugin-opt flags it doesn't understand: rust-lang/rust#60059 However the bug will be unresolved for other build targets that are link-driven by Rust. [email protected] Bug: 1386212 Change-Id: I21824ad484048f0bc283454579f2f603acf3fa99 Cq-Include-Trybots: luci.chromium.try:win-rust-x64-rel,win-rust-x64-dbg,linux-rust-x64-rel,linux-rust-x64-dbg,android-rust-arm64-rel,android-rust-arm64-dbg,android-rust-arm32-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4545355 Commit-Queue: danakj <[email protected]> Reviewed-by: Bruce Dawson <[email protected]> Auto-Submit: danakj <[email protected]> Commit-Queue: Bruce Dawson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1146226} NOKEYCHECK=True GitOrigin-RevId: df7d81e33033a594ff56d5ab8387aa1f13cd1c39
1 parent 5972f46 commit ab552cc

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

toolchain/apple/toolchain.gni

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,14 @@ template("apple_toolchain") {
807807
}
808808

809809
if (enable_rust && current_toolchain == default_toolchain) {
810-
# Make an additional toolchain which uses the prebuilt stdlib shipped with
811-
# rustc.
810+
# Make an additional toolchain which is used for making tools that are run
811+
# on the host machine as part of the build process (such as proc macros
812+
# and Cargo build scripts). This toolchain uses the prebuilt stdlib that
813+
# comes with the compiler, so it doesn't have to wait for the stdlib to be
814+
# built before building other stuff. And this ensures its proc macro
815+
# outputs have the right ABI to be loaded by the compiler, and it can be
816+
# used to compile build scripts that are part of the stdlib that is built
817+
# for the default toolchain.
812818
single_apple_toolchain("${target_name}_for_rust_host_build_tools") {
813819
assert(defined(invoker.toolchain_args),
814820
"Toolchains must declare toolchain_args")
@@ -823,8 +829,12 @@ template("apple_toolchain") {
823829
# Populate toolchain args from the invoker.
824830
forward_variables_from(invoker.toolchain_args, "*")
825831
toolchain_for_rust_host_build_tools = true
832+
833+
# The host build tools are static release builds to make the Chromium
834+
# build faster. They do not need PGO etc, so no official builds.
826835
is_debug = false
827836
is_component_build = false
837+
is_official_build = false
828838
}
829839
}
830840
}

toolchain/gcc_toolchain.gni

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,8 +827,14 @@ template("gcc_toolchain") {
827827
}
828828

829829
if (enable_rust && current_toolchain == default_toolchain) {
830-
# Make an additional toolchain which uses the prebuilt stdlib shipped with
831-
# rustc.
830+
# Make an additional toolchain which is used for making tools that are run
831+
# on the host machine as part of the build process (such as proc macros
832+
# and Cargo build scripts). This toolchain uses the prebuilt stdlib that
833+
# comes with the compiler, so it doesn't have to wait for the stdlib to be
834+
# built before building other stuff. And this ensures its proc macro
835+
# outputs have the right ABI to be loaded by the compiler, and it can be
836+
# used to compile build scripts that are part of the stdlib that is built
837+
# for the default toolchain.
832838
single_gcc_toolchain("${target_name}_for_rust_host_build_tools") {
833839
assert(defined(invoker.toolchain_args),
834840
"Toolchains must declare toolchain_args")
@@ -848,6 +854,7 @@ template("gcc_toolchain") {
848854
# build faster.
849855
is_debug = false
850856
is_component_build = false
857+
is_official_build = false
851858
}
852859
}
853860
}

toolchain/win/toolchain.gni

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,14 @@ template("msvc_toolchain") {
582582
}
583583

584584
if (enable_rust && current_toolchain == default_toolchain) {
585-
# Make an additional toolchain which uses the prebuilt stdlib shipped with
586-
# rustc.
585+
# Make an additional toolchain which is used for making tools that are run
586+
# on the host machine as part of the build process (such as proc macros
587+
# and Cargo build scripts). This toolchain uses the prebuilt stdlib that
588+
# comes with the compiler, so it doesn't have to wait for the stdlib to be
589+
# built before building other stuff. And this ensures its proc macro
590+
# outputs have the right ABI to be loaded by the compiler, and it can be
591+
# used to compile build scripts that are part of the stdlib that is built
592+
# for the default toolchain.
587593
single_msvc_toolchain("${target_name}_for_rust_host_build_tools") {
588594
assert(defined(invoker.toolchain_args),
589595
"Toolchains must declare toolchain_args")
@@ -600,9 +606,10 @@ template("msvc_toolchain") {
600606
toolchain_for_rust_host_build_tools = true
601607

602608
# The host build tools are static release builds to make the Chromium
603-
# build faster.
609+
# build faster. They do not need PGO etc, so no official builds.
604610
is_debug = false
605611
is_component_build = false
612+
is_official_build = false
606613
}
607614
}
608615
}

0 commit comments

Comments
 (0)