From f912efd2e836a5649a991763a78bb7e018349c85 Mon Sep 17 00:00:00 2001 From: Ian Cottrell Date: Wed, 13 Dec 2017 12:45:43 -0500 Subject: [PATCH] Force bootstrap toolchain to be non race (#1134) Also if pure is set, disable race Fixes #1133 Fixes #1016 --- go/private/go_toolchain.bzl | 1 + go/private/mode.bzl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/go/private/go_toolchain.bzl b/go/private/go_toolchain.bzl index 182b98cfcb..8cb786a6bd 100644 --- a/go/private/go_toolchain.bzl +++ b/go/private/go_toolchain.bzl @@ -45,6 +45,7 @@ def _go_toolchain_impl(ctx): return [platform_common.ToolchainInfo( name = ctx.label.name, cross_compile = ctx.attr.cross_compile, + bootstrap = ctx.attr.bootstrap, default_goos = ctx.attr.goos, default_goarch = ctx.attr.goarch, stdlib = struct( diff --git a/go/private/mode.bzl b/go/private/mode.bzl index fe8b3a8f82..17a9c2b331 100644 --- a/go/private/mode.bzl +++ b/go/private/mode.bzl @@ -57,6 +57,7 @@ def get_mode(ctx, toolchain_flags): # We always have to use the pure stdlib in cross compilation mode force_pure = "on" if go_toolchain.cross_compile else "auto" + force_race = "off" if go_toolchain.bootstrap else "auto" #TODO: allow link mode selection static = _ternary( @@ -65,6 +66,7 @@ def get_mode(ctx, toolchain_flags): ) race = _ternary( getattr(ctx.attr, "race", None), + force_race, "race" in ctx.features, ) msan = _ternary( @@ -76,6 +78,9 @@ def get_mode(ctx, toolchain_flags): force_pure, "pure" in ctx.features, ) + if race and pure: + # You are not allowed to compile in race mode with pure enabled + race = False debug = ctx.var["COMPILATION_MODE"] == "debug" strip_mode = "sometimes" if toolchain_flags: