Skip to content

Commit

Permalink
Exclude unsupported C/C++ features (#3189)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum authored Jun 18, 2022
1 parent 1cca135 commit 6f11412
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion go/private/context.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ _LINKER_OPTIONS_BLACKLIST = {
"-Wl,--gc-sections": None,
}

_UNSUPPORTED_FEATURES = [
# These toolchain features require special rule support and will thus break
# with CGo.
# Taken from https://github.com/bazelbuild/rules_rust/blob/521e649ff44e9711fe3c45b0ec1e792f7e1d361e/rust/private/utils.bzl#L20.
"thin_lto",
"module_maps",
"use_header_modules",
"fdo_instrument",
"fdo_optimize",
]

def _match_option(option, pattern):
if pattern.endswith("="):
return option.startswith(pattern)
Expand Down Expand Up @@ -580,7 +591,7 @@ def _cgo_context_data_impl(ctx):
ctx = ctx,
cc_toolchain = cc_toolchain,
requested_features = ctx.features,
unsupported_features = ctx.disabled_features,
unsupported_features = ctx.disabled_features + _UNSUPPORTED_FEATURES,
)

# TODO(jayconrod): keep the environment separate for different actions.
Expand Down

0 comments on commit 6f11412

Please sign in to comment.