Skip to content

Commit

Permalink
Force bootstrap toolchain to be non race (#1134)
Browse files Browse the repository at this point in the history
Also if pure is set, disable race

Fixes #1133
Fixes #1016
  • Loading branch information
ianthehat authored and jayconrod committed Dec 13, 2017
1 parent f74269b commit f912efd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions go/private/go_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 5 additions & 0 deletions go/private/mode.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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:
Expand Down

0 comments on commit f912efd

Please sign in to comment.