mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 04:54:05 -05:00
Update bazel to 6.1.0 (#12121)
* Update references for cc toolchain after removal of @bazel_tools//cpp/cc_toolchain_config.bzl in 1727361563
* Update to bazel 6.1.0
* Update cross-toolchain configs
This commit is contained in:
@@ -1 +1 @@
|
||||
5.3.0
|
||||
6.1.0
|
||||
|
||||
@@ -36,7 +36,7 @@ rbe_configs_gen \
|
||||
--generate_cpp_configs=true \
|
||||
--generate_java_configs=true \
|
||||
--cpp_env_json=tools/cross-toolchain/cpp_env_clang.json \
|
||||
--toolchain_container=gcr.io/prysmaticlabs/rbe-worker@sha256:9a30c5ff7dcd1fbc5cb5b5f320782dec755a31cd2f6811e238a8584d94b04e78 # The sha256 digest from step 2.
|
||||
--toolchain_container=gcr.io/prysmaticlabs/rbe-worker@sha256:90d490709a0fb0c817569f37408823a0490e5502cbecc36415caabfc36a0c2e8 # The sha256 digest from step 2.
|
||||
```
|
||||
|
||||
4) Test the builds work locally for all supported platforms.
|
||||
|
||||
@@ -11,12 +11,36 @@ load(
|
||||
"with_feature_set",
|
||||
)
|
||||
|
||||
load(
|
||||
"@bazel_tools//tools/cpp:cc_toolchain_config.bzl",
|
||||
ALL_COMPILE_ACTIONS = "all_compile_actions",
|
||||
ALL_CPP_COMPILE_ACTIONS = "all_cpp_compile_actions",
|
||||
ALL_LINK_ACTIONS = "all_link_actions",
|
||||
)
|
||||
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
|
||||
|
||||
all_compile_actions = [
|
||||
ACTION_NAMES.c_compile,
|
||||
ACTION_NAMES.cpp_compile,
|
||||
ACTION_NAMES.linkstamp_compile,
|
||||
ACTION_NAMES.assemble,
|
||||
ACTION_NAMES.preprocess_assemble,
|
||||
ACTION_NAMES.cpp_header_parsing,
|
||||
ACTION_NAMES.cpp_module_compile,
|
||||
ACTION_NAMES.cpp_module_codegen,
|
||||
ACTION_NAMES.clif_match,
|
||||
ACTION_NAMES.lto_backend,
|
||||
]
|
||||
|
||||
all_cpp_compile_actions = [
|
||||
ACTION_NAMES.cpp_compile,
|
||||
ACTION_NAMES.linkstamp_compile,
|
||||
ACTION_NAMES.cpp_header_parsing,
|
||||
ACTION_NAMES.cpp_module_compile,
|
||||
ACTION_NAMES.cpp_module_codegen,
|
||||
ACTION_NAMES.clif_match,
|
||||
]
|
||||
|
||||
all_link_actions = [
|
||||
ACTION_NAMES.cpp_link_executable,
|
||||
ACTION_NAMES.cpp_link_dynamic_library,
|
||||
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
|
||||
]
|
||||
|
||||
|
||||
def _impl(ctx):
|
||||
toolchain_identifier = "clang-linux-cross"
|
||||
@@ -79,7 +103,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
@@ -105,7 +129,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
@@ -123,12 +147,12 @@ def _impl(ctx):
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [flag_group(flags = ["-g", "-fstandalone-debug"])],
|
||||
with_features = [with_feature_set(features = ["dbg"])],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
@@ -144,7 +168,7 @@ def _impl(ctx):
|
||||
with_features = [with_feature_set(features = ["opt"])],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_CPP_COMPILE_ACTIONS,
|
||||
actions = all_cpp_compile_actions,
|
||||
flag_groups = [flag_group(flags = ["-std=c++17", "-nostdinc++"])],
|
||||
),
|
||||
],
|
||||
@@ -164,7 +188,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_LINK_ACTIONS,
|
||||
actions = all_link_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = additional_link_flags + [
|
||||
@@ -180,7 +204,7 @@ def _impl(ctx):
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_LINK_ACTIONS,
|
||||
actions = all_link_actions,
|
||||
flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
|
||||
with_features = [with_feature_set(features = ["opt"])],
|
||||
),
|
||||
@@ -203,7 +227,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
expand_if_available = "user_compile_flags",
|
||||
@@ -220,7 +244,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS + ALL_LINK_ACTIONS,
|
||||
actions = all_compile_actions + all_link_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
expand_if_available = "sysroot",
|
||||
@@ -235,7 +259,7 @@ def _impl(ctx):
|
||||
name = "coverage",
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = ["-fprofile-instr-generate", "-fcoverage-mapping"],
|
||||
@@ -243,7 +267,7 @@ def _impl(ctx):
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_LINK_ACTIONS,
|
||||
actions = all_link_actions,
|
||||
flag_groups = [flag_group(flags = ["-fprofile-instr-generate"])],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -11,12 +11,35 @@ load(
|
||||
"with_feature_set",
|
||||
)
|
||||
|
||||
load(
|
||||
"@bazel_tools//tools/cpp:cc_toolchain_config.bzl",
|
||||
ALL_COMPILE_ACTIONS = "all_compile_actions",
|
||||
ALL_CPP_COMPILE_ACTIONS = "all_cpp_compile_actions",
|
||||
ALL_LINK_ACTIONS = "all_link_actions",
|
||||
)
|
||||
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
|
||||
|
||||
all_compile_actions = [
|
||||
ACTION_NAMES.c_compile,
|
||||
ACTION_NAMES.cpp_compile,
|
||||
ACTION_NAMES.linkstamp_compile,
|
||||
ACTION_NAMES.assemble,
|
||||
ACTION_NAMES.preprocess_assemble,
|
||||
ACTION_NAMES.cpp_header_parsing,
|
||||
ACTION_NAMES.cpp_module_compile,
|
||||
ACTION_NAMES.cpp_module_codegen,
|
||||
ACTION_NAMES.clif_match,
|
||||
ACTION_NAMES.lto_backend,
|
||||
]
|
||||
|
||||
all_cpp_compile_actions = [
|
||||
ACTION_NAMES.cpp_compile,
|
||||
ACTION_NAMES.linkstamp_compile,
|
||||
ACTION_NAMES.cpp_header_parsing,
|
||||
ACTION_NAMES.cpp_module_compile,
|
||||
ACTION_NAMES.cpp_module_codegen,
|
||||
ACTION_NAMES.clif_match,
|
||||
]
|
||||
|
||||
all_link_actions = [
|
||||
ACTION_NAMES.cpp_link_executable,
|
||||
ACTION_NAMES.cpp_link_dynamic_library,
|
||||
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
|
||||
]
|
||||
|
||||
def _impl(ctx):
|
||||
toolchain_identifier = "osxcross"
|
||||
@@ -62,7 +85,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
@@ -89,7 +112,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
@@ -108,12 +131,12 @@ def _impl(ctx):
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [flag_group(flags = ["-g", "-fstandalone-debug"])],
|
||||
with_features = [with_feature_set(features = ["dbg"])],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
@@ -129,7 +152,7 @@ def _impl(ctx):
|
||||
with_features = [with_feature_set(features = ["opt"])],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_CPP_COMPILE_ACTIONS,
|
||||
actions = all_cpp_compile_actions,
|
||||
flag_groups = [flag_group(flags = ["-std=c++17", "-nostdinc++"])],
|
||||
),
|
||||
],
|
||||
@@ -140,7 +163,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_LINK_ACTIONS,
|
||||
actions = all_link_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
@@ -176,7 +199,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
expand_if_available = "user_compile_flags",
|
||||
@@ -192,7 +215,7 @@ def _impl(ctx):
|
||||
name = "coverage",
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_COMPILE_ACTIONS,
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = ["-fprofile-instr-generate", "-fcoverage-mapping"],
|
||||
@@ -200,7 +223,7 @@ def _impl(ctx):
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = ALL_LINK_ACTIONS,
|
||||
actions = all_link_actions,
|
||||
flag_groups = [flag_group(flags = ["-fprofile-instr-generate"])],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -14,15 +14,14 @@ load(
|
||||
"env_entry",
|
||||
)
|
||||
|
||||
load(
|
||||
"@bazel_tools//tools/cpp:cc_toolchain_config.bzl",
|
||||
ALL_COMPILE_ACTIONS = "all_compile_actions",
|
||||
ALL_CPP_COMPILE_ACTIONS = "all_cpp_compile_actions",
|
||||
ALL_LINK_ACTIONS = "all_link_actions",
|
||||
)
|
||||
|
||||
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
|
||||
|
||||
all_link_actions = [
|
||||
ACTION_NAMES.cpp_link_executable,
|
||||
ACTION_NAMES.cpp_link_dynamic_library,
|
||||
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
|
||||
]
|
||||
|
||||
def _impl(ctx):
|
||||
toolchain_identifier = "msys_x64_mingw"
|
||||
host_system_name = "local"
|
||||
@@ -140,7 +139,7 @@ def _impl(ctx):
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = ALL_LINK_ACTIONS,
|
||||
actions = all_link_actions,
|
||||
flag_groups = ([flag_group(flags = msys_mingw_link_flags)] if msys_mingw_link_flags else []),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -132,6 +132,7 @@ cc_toolchain_config(
|
||||
"ar": "/usr/bin/ar",
|
||||
"ld": "/usr/bin/ld",
|
||||
"llvm-cov": "/usr/bin/llvm-cov",
|
||||
"llvm-profdata": "/usr/bin/llvm-profdata",
|
||||
"cpp": "/usr/bin/cpp",
|
||||
"gcc": "/usr/bin/clang-12",
|
||||
"dwp": "/usr/bin/dwp",
|
||||
|
||||
@@ -43,12 +43,12 @@ def _impl(ctx):
|
||||
|
||||
tool_paths = [
|
||||
tool_path(name = "ar", path = "/bin/false"),
|
||||
tool_path(name = "compat-ld", path = "/bin/false"),
|
||||
tool_path(name = "cpp", path = "/bin/false"),
|
||||
tool_path(name = "dwp", path = "/bin/false"),
|
||||
tool_path(name = "gcc", path = "/bin/false"),
|
||||
tool_path(name = "gcov", path = "/bin/false"),
|
||||
tool_path(name = "ld", path = "/bin/false"),
|
||||
tool_path(name = "llvm-profdata", path = "/bin/false"),
|
||||
tool_path(name = "nm", path = "/bin/false"),
|
||||
tool_path(name = "objcopy", path = "/bin/false"),
|
||||
tool_path(name = "objdump", path = "/bin/false"),
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
load(
|
||||
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
|
||||
"action_config",
|
||||
"artifact_name_pattern",
|
||||
"feature",
|
||||
"feature_set",
|
||||
"flag_group",
|
||||
@@ -142,6 +143,34 @@ lto_index_actions = [
|
||||
ACTION_NAMES.lto_index_for_nodeps_dynamic_library,
|
||||
]
|
||||
|
||||
def _sanitizer_feature(name = "", specific_compile_flags = [], specific_link_flags = []):
|
||||
return feature(
|
||||
name = name,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = all_compile_actions,
|
||||
flag_groups = [
|
||||
flag_group(flags = [
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fno-sanitize-recover=all",
|
||||
] + specific_compile_flags),
|
||||
],
|
||||
with_features = [
|
||||
with_feature_set(features = [name]),
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = all_link_actions,
|
||||
flag_groups = [
|
||||
flag_group(flags = specific_link_flags),
|
||||
],
|
||||
with_features = [
|
||||
with_feature_set(features = [name]),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
def _impl(ctx):
|
||||
tool_paths = [
|
||||
tool_path(name = name, path = path)
|
||||
@@ -390,6 +419,7 @@ def _impl(ctx):
|
||||
|
||||
per_object_debug_info_feature = feature(
|
||||
name = "per_object_debug_info",
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = [
|
||||
@@ -484,13 +514,19 @@ def _impl(ctx):
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
"-Wl,-rpath,$EXEC_ORIGIN/%{runtime_library_search_directories}",
|
||||
"-Xlinker",
|
||||
"-rpath",
|
||||
"-Xlinker",
|
||||
"$EXEC_ORIGIN/%{runtime_library_search_directories}",
|
||||
],
|
||||
expand_if_true = "is_cc_test",
|
||||
),
|
||||
flag_group(
|
||||
flags = [
|
||||
"-Wl,-rpath,$ORIGIN/%{runtime_library_search_directories}",
|
||||
"-Xlinker",
|
||||
"-rpath",
|
||||
"-Xlinker",
|
||||
"$ORIGIN/%{runtime_library_search_directories}",
|
||||
],
|
||||
expand_if_false = "is_cc_test",
|
||||
),
|
||||
@@ -511,7 +547,10 @@ def _impl(ctx):
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
"-Wl,-rpath,$ORIGIN/%{runtime_library_search_directories}",
|
||||
"-Xlinker",
|
||||
"-rpath",
|
||||
"-Xlinker",
|
||||
"$ORIGIN/%{runtime_library_search_directories}",
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -727,41 +766,6 @@ def _impl(ctx):
|
||||
],
|
||||
)
|
||||
|
||||
llvm_coverage_map_format_feature = feature(
|
||||
name = "llvm_coverage_map_format",
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = [
|
||||
ACTION_NAMES.preprocess_assemble,
|
||||
ACTION_NAMES.c_compile,
|
||||
ACTION_NAMES.cpp_compile,
|
||||
ACTION_NAMES.cpp_module_compile,
|
||||
ACTION_NAMES.objc_compile,
|
||||
ACTION_NAMES.objcpp_compile,
|
||||
],
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
"-fprofile-instr-generate",
|
||||
"-fcoverage-mapping",
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = all_link_actions + lto_index_actions + [
|
||||
"objc-executable",
|
||||
"objc++-executable",
|
||||
],
|
||||
flag_groups = [
|
||||
flag_group(flags = ["-fprofile-instr-generate"]),
|
||||
],
|
||||
),
|
||||
],
|
||||
requires = [feature_set(features = ["coverage"])],
|
||||
provides = ["profile"],
|
||||
)
|
||||
|
||||
strip_debug_symbols_feature = feature(
|
||||
name = "strip_debug_symbols",
|
||||
flag_sets = [
|
||||
@@ -905,7 +909,18 @@ def _impl(ctx):
|
||||
iterate_over = "user_link_flags",
|
||||
expand_if_available = "user_link_flags",
|
||||
),
|
||||
] + ([flag_group(flags = ctx.attr.link_libs)] if ctx.attr.link_libs else []),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
default_link_libs_feature = feature(
|
||||
name = "default_link_libs",
|
||||
enabled = True,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = all_link_actions + lto_index_actions,
|
||||
flag_groups = [flag_group(flags = ctx.attr.link_libs)] if ctx.attr.link_libs else [],
|
||||
),
|
||||
],
|
||||
)
|
||||
@@ -948,36 +963,6 @@ def _impl(ctx):
|
||||
],
|
||||
)
|
||||
|
||||
gcc_coverage_map_format_feature = feature(
|
||||
name = "gcc_coverage_map_format",
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = [
|
||||
ACTION_NAMES.preprocess_assemble,
|
||||
ACTION_NAMES.c_compile,
|
||||
ACTION_NAMES.cpp_compile,
|
||||
ACTION_NAMES.cpp_module_compile,
|
||||
ACTION_NAMES.objc_compile,
|
||||
ACTION_NAMES.objcpp_compile,
|
||||
"objc-executable",
|
||||
"objc++-executable",
|
||||
],
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = ["-fprofile-arcs", "-ftest-coverage"],
|
||||
expand_if_available = "gcov_gcno_file",
|
||||
),
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = all_link_actions + lto_index_actions,
|
||||
flag_groups = [flag_group(flags = ["--coverage"])],
|
||||
),
|
||||
],
|
||||
requires = [feature_set(features = ["coverage"])],
|
||||
provides = ["profile"],
|
||||
)
|
||||
|
||||
archiver_flags_feature = feature(
|
||||
name = "archiver_flags",
|
||||
flag_sets = [
|
||||
@@ -990,6 +975,26 @@ def _impl(ctx):
|
||||
expand_if_available = "output_execpath",
|
||||
),
|
||||
],
|
||||
with_features = [
|
||||
with_feature_set(
|
||||
not_features = ["libtool"],
|
||||
),
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = [ACTION_NAMES.cpp_link_static_library],
|
||||
flag_groups = [
|
||||
flag_group(flags = ["-static", "-s"]),
|
||||
flag_group(
|
||||
flags = ["-o", "%{output_execpath}"],
|
||||
expand_if_available = "output_execpath",
|
||||
),
|
||||
],
|
||||
with_features = [
|
||||
with_feature_set(
|
||||
features = ["libtool"],
|
||||
),
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = [ACTION_NAMES.cpp_link_static_library],
|
||||
@@ -1017,6 +1022,14 @@ def _impl(ctx):
|
||||
),
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = [ACTION_NAMES.cpp_link_static_library],
|
||||
flag_groups = ([
|
||||
flag_group(
|
||||
flags = ctx.attr.archive_flags,
|
||||
),
|
||||
] if ctx.attr.archive_flags else []),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1089,7 +1102,6 @@ def _impl(ctx):
|
||||
],
|
||||
)
|
||||
|
||||
dynamic_library_linker_tool_path = tool_paths
|
||||
dynamic_library_linker_tool_feature = feature(
|
||||
name = "dynamic_library_linker_tool",
|
||||
flag_sets = [
|
||||
@@ -1221,10 +1233,66 @@ def _impl(ctx):
|
||||
],
|
||||
)
|
||||
|
||||
treat_warnings_as_errors_feature = feature(
|
||||
name = "treat_warnings_as_errors",
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
|
||||
flag_groups = [flag_group(flags = ["-Werror"])],
|
||||
),
|
||||
flag_set(
|
||||
actions = all_link_actions,
|
||||
flag_groups = [flag_group(flags = ["-Wl,-fatal-warnings"])],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
archive_param_file_feature = feature(
|
||||
name = "archive_param_file",
|
||||
enabled = True,
|
||||
)
|
||||
|
||||
asan_feature = _sanitizer_feature(
|
||||
name = "asan",
|
||||
specific_compile_flags = [
|
||||
"-fsanitize=address",
|
||||
"-fno-common",
|
||||
],
|
||||
specific_link_flags = [
|
||||
"-fsanitize=address",
|
||||
],
|
||||
)
|
||||
|
||||
tsan_feature = _sanitizer_feature(
|
||||
name = "tsan",
|
||||
specific_compile_flags = [
|
||||
"-fsanitize=thread",
|
||||
],
|
||||
specific_link_flags = [
|
||||
"-fsanitize=thread",
|
||||
],
|
||||
)
|
||||
|
||||
ubsan_feature = _sanitizer_feature(
|
||||
name = "ubsan",
|
||||
specific_compile_flags = [
|
||||
"-fsanitize=undefined",
|
||||
],
|
||||
specific_link_flags = [
|
||||
"-fsanitize=undefined",
|
||||
],
|
||||
)
|
||||
|
||||
is_linux = ctx.attr.target_libc != "macosx"
|
||||
libtool_feature = feature(
|
||||
name = "libtool",
|
||||
enabled = not is_linux,
|
||||
)
|
||||
|
||||
# TODO(#8303): Mac crosstool should also declare every feature.
|
||||
if is_linux:
|
||||
# Linux artifact name patterns are the default.
|
||||
artifact_name_patterns = []
|
||||
features = [
|
||||
dependency_file_feature,
|
||||
serialized_diagnostics_file_feature,
|
||||
@@ -1249,12 +1317,16 @@ def _impl(ctx):
|
||||
output_execpath_flags_feature,
|
||||
runtime_library_search_directories_feature,
|
||||
library_search_directories_feature,
|
||||
libtool_feature,
|
||||
archiver_flags_feature,
|
||||
force_pic_flags_feature,
|
||||
fission_support_feature,
|
||||
strip_debug_symbols_feature,
|
||||
coverage_feature,
|
||||
supports_pic_feature,
|
||||
asan_feature,
|
||||
tsan_feature,
|
||||
ubsan_feature,
|
||||
] + (
|
||||
[
|
||||
supports_start_end_lib_feature,
|
||||
@@ -1264,6 +1336,7 @@ def _impl(ctx):
|
||||
default_link_flags_feature,
|
||||
libraries_to_link_feature,
|
||||
user_link_flags_feature,
|
||||
default_link_libs_feature,
|
||||
static_libgcc_feature,
|
||||
fdo_optimize_feature,
|
||||
supports_dynamic_linker_feature,
|
||||
@@ -1272,10 +1345,26 @@ def _impl(ctx):
|
||||
user_compile_flags_feature,
|
||||
sysroot_feature,
|
||||
unfiltered_compile_flags_feature,
|
||||
treat_warnings_as_errors_feature,
|
||||
archive_param_file_feature,
|
||||
] + layering_check_features(ctx.attr.compiler)
|
||||
else:
|
||||
# macOS artifact name patterns differ from the defaults only for dynamic
|
||||
# libraries.
|
||||
artifact_name_patterns = [
|
||||
artifact_name_pattern(
|
||||
category_name = "dynamic_library",
|
||||
prefix = "lib",
|
||||
extension = ".dylib",
|
||||
),
|
||||
]
|
||||
features = [
|
||||
libtool_feature,
|
||||
archiver_flags_feature,
|
||||
supports_pic_feature,
|
||||
asan_feature,
|
||||
tsan_feature,
|
||||
ubsan_feature,
|
||||
] + (
|
||||
[
|
||||
supports_start_end_lib_feature,
|
||||
@@ -1285,6 +1374,7 @@ def _impl(ctx):
|
||||
default_compile_flags_feature,
|
||||
default_link_flags_feature,
|
||||
user_link_flags_feature,
|
||||
default_link_libs_feature,
|
||||
fdo_optimize_feature,
|
||||
supports_dynamic_linker_feature,
|
||||
dbg_feature,
|
||||
@@ -1292,12 +1382,15 @@ def _impl(ctx):
|
||||
user_compile_flags_feature,
|
||||
sysroot_feature,
|
||||
unfiltered_compile_flags_feature,
|
||||
treat_warnings_as_errors_feature,
|
||||
archive_param_file_feature,
|
||||
] + layering_check_features(ctx.attr.compiler)
|
||||
|
||||
return cc_common.create_cc_toolchain_config_info(
|
||||
ctx = ctx,
|
||||
features = features,
|
||||
action_configs = action_configs,
|
||||
artifact_name_patterns = artifact_name_patterns,
|
||||
cxx_builtin_include_directories = ctx.attr.cxx_builtin_include_directories,
|
||||
toolchain_identifier = ctx.attr.toolchain_identifier,
|
||||
host_system_name = ctx.attr.host_system_name,
|
||||
@@ -1329,6 +1422,7 @@ cc_toolchain_config = rule(
|
||||
"opt_compile_flags": attr.string_list(),
|
||||
"cxx_flags": attr.string_list(),
|
||||
"link_flags": attr.string_list(),
|
||||
"archive_flags": attr.string_list(),
|
||||
"link_libs": attr.string_list(),
|
||||
"opt_link_flags": attr.string_list(),
|
||||
"unfiltered_compile_flags": attr.string_list(),
|
||||
|
||||
Reference in New Issue
Block a user