@@ -59,6 +59,8 @@ def _join(path1, path2):
5959def llvm_config_impl (rctx ):
6060 _check_os_arch_keys (rctx .attr .sysroot )
6161 _check_os_arch_keys (rctx .attr .cxx_builtin_include_directories )
62+ _check_os_arch_keys (rctx .attr .extra_exec_compatible_with )
63+ _check_os_arch_keys (rctx .attr .extra_target_compatible_with )
6264
6365 os = _os (rctx )
6466 if os == "windows" :
@@ -166,6 +168,8 @@ def llvm_config_impl(rctx):
166168 unfiltered_compile_flags_dict = rctx .attr .unfiltered_compile_flags ,
167169 llvm_version = llvm_version ,
168170 extra_compiler_files = rctx .attr .extra_compiler_files ,
171+ extra_exec_compatible_with = rctx .attr .extra_exec_compatible_with ,
172+ extra_target_compatible_with = rctx .attr .extra_target_compatible_with ,
169173 )
170174 exec_dl_ext = "dylib" if os == "darwin" else "so"
171175 cc_toolchains_str , toolchain_labels_str = _cc_toolchains_str (
@@ -380,11 +384,11 @@ toolchain(
380384 exec_compatible_with = [
381385 "@platforms//cpu:{exec_arch}",
382386 "@platforms//os:{exec_os_bzl}",
383- ],
387+ ] + {extra_exec_compatible_with_specific} + {extra_exec_compatible_with_all_targets} ,
384388 target_compatible_with = [
385389 "@platforms//cpu:{target_arch}",
386390 "@platforms//os:{target_os_bzl}",
387- ],
391+ ] + {extra_target_compatible_with_specific} + {extra_target_compatible_with_all_targets} ,
388392 target_settings = {target_settings},
389393 toolchain = ":cc-clang-{suffix}",
390394 toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
@@ -543,6 +547,10 @@ cc_toolchain(
543547 ]),
544548 extra_compiler_files = ("\" %s\" ," % str (toolchain_info .extra_compiler_files )) if toolchain_info .extra_compiler_files else "" ,
545549 major_llvm_version = major_llvm_version ,
550+ extra_exec_compatible_with_specific = toolchain_info .extra_exec_compatible_with .get (target_pair , []),
551+ extra_target_compatible_with_specific = toolchain_info .extra_target_compatible_with .get (target_pair , []),
552+ extra_exec_compatible_with_all_targets = toolchain_info .extra_exec_compatible_with .get ("" , []),
553+ extra_target_compatible_with_all_targets = toolchain_info .extra_target_compatible_with .get ("" , []),
546554 )
547555
548556def _convenience_targets_str (rctx , use_absolute_paths , llvm_dist_rel_path , llvm_dist_label_prefix , exec_dl_ext ):
0 commit comments