Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cc/toolchains/impl/toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def cc_toolchain_config_impl_helper(ctx):
# compiler
compiler = ctx.attr.compiler,
target_cpu = ctx.attr.cpu,
target_libc = ctx.attr.target_libc, # Used by legacy features to determine if we're building for Apple platfroms or not
target_system_name = ctx.expand_make_variables("target_system_name", ctx.attr.target_system_name, {}),
# These fields are only relevant for legacy toolchain resolution.
target_libc = "",
abi_version = "",
abi_libc_version = "",
),
Expand All @@ -120,6 +120,7 @@ CC_TOOLCHAIN_CONFIG_PUBLIC_ATTRS = {
# Attributes new to this rule.
"compiler": attr.string(default = ""),
"cpu": attr.string(default = ""),
"target_libc": attr.string(default = ""),
"target_system_name": attr.string(default = ""),
"tool_map": attr.label(providers = [ToolConfigInfo], mandatory = True),
"args": attr.label_list(providers = [ArgsListInfo]),
Expand Down
7 changes: 7 additions & 0 deletions cc/toolchains/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ def cc_toolchain(
"//conditions:default": "",
})

target_libc = select({
Label("//cc/settings:apple_constraint"): "macosx",
"//conditions:default": "",
})

if bazel_features.cc.supports_starlarkified_toolchains:
_cc_toolchain(
name = name,
Expand All @@ -183,6 +188,7 @@ def cc_toolchain(
known_features = known_features,
enabled_features = enabled_features,
compiler = compiler,
target_libc = target_libc,
cpu = cpu or _CPU,
target_system_name = target_system_name,
dynamic_runtime_lib = dynamic_runtime_lib,
Expand All @@ -208,6 +214,7 @@ def cc_toolchain(
enabled_features = enabled_features,
compiler = compiler,
cpu = cpu or _CPU,
target_libc = target_libc,
target_system_name = target_system_name,
visibility = ["//visibility:private"],
**kwargs
Expand Down