@@ -59,6 +59,8 @@ def _join(path1, path2):
59
59
def llvm_config_impl (rctx ):
60
60
_check_os_arch_keys (rctx .attr .sysroot )
61
61
_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 )
62
64
63
65
os = _os (rctx )
64
66
if os == "windows" :
@@ -166,6 +168,8 @@ def llvm_config_impl(rctx):
166
168
unfiltered_compile_flags_dict = rctx .attr .unfiltered_compile_flags ,
167
169
llvm_version = llvm_version ,
168
170
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 ,
169
173
)
170
174
exec_dl_ext = "dylib" if os == "darwin" else "so"
171
175
cc_toolchains_str , toolchain_labels_str = _cc_toolchains_str (
@@ -380,11 +384,11 @@ toolchain(
380
384
exec_compatible_with = [
381
385
"@platforms//cpu:{exec_arch}",
382
386
"@platforms//os:{exec_os_bzl}",
383
- ],
387
+ ] + {extra_exec_compatible_with_specific} + {extra_exec_compatible_with_all_targets} ,
384
388
target_compatible_with = [
385
389
"@platforms//cpu:{target_arch}",
386
390
"@platforms//os:{target_os_bzl}",
387
- ],
391
+ ] + {extra_target_compatible_with_specific} + {extra_target_compatible_with_all_targets} ,
388
392
target_settings = {target_settings},
389
393
toolchain = ":cc-clang-{suffix}",
390
394
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
@@ -543,6 +547,10 @@ cc_toolchain(
543
547
]),
544
548
extra_compiler_files = ("\" %s\" ," % str (toolchain_info .extra_compiler_files )) if toolchain_info .extra_compiler_files else "" ,
545
549
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 ("" , "[]" ),
546
554
)
547
555
548
556
def _convenience_targets_str (rctx , use_absolute_paths , llvm_dist_rel_path , llvm_dist_label_prefix , exec_dl_ext ):
0 commit comments