Skip to content

Commit 0013115

Browse files
comiuscopybara-github
authored andcommitted
Rollforward of e06c0ac: Blank out value of crosstool_top when C++ toolchain resolution is enabled
Without this change, analysis fails in case --crosstool_top is set to a cc_toolchain_suite that doesn't have a toolchain matching the --cpu value. This prevented removing --crosstool_top flag, because the default value only supports a limited set of cpus. PiperOrigin-RevId: 532073937 Change-Id: Ic869540008e38d2a28e7919fb17db3f9791522f6
1 parent 4998a55 commit 0013115

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,16 @@ public CppConfiguration(BuildOptions options) throws InvalidConfigurationExcepti
300300
doc = "The label of the target describing the C++ toolchain",
301301
defaultLabel = "//tools/cpp:toolchain",
302302
defaultInToolRepository = true)
303+
@Nullable
303304
public Label getRuleProvidingCcToolchainProvider() {
304-
return cppOptions.crosstoolTop;
305+
if (cppOptions.enableCcToolchainResolution) {
306+
// In case C++ toolchain resolution is enabled, crosstool_top flags are not used.
307+
// Returning null prevents additional work on the flags values and makes it possible to
308+
// remove `--crosstool_top` flags.
309+
return null;
310+
} else {
311+
return cppOptions.crosstoolTop;
312+
}
305313
}
306314

307315
/** Returns the configured current compilation mode. */

0 commit comments

Comments
 (0)