1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ load ("@bazel_features//:features.bzl" , "bazel_features" )
1516load ("@bazel_skylib//lib:paths.bzl" , "paths" )
1617load (
1718 "//toolchain:aliases.bzl" ,
@@ -329,7 +330,7 @@ def _cc_toolchain_str(
329330 # TODO: Are there other situations where we can continue?
330331 return ""
331332
332- extra_files_str = repr (":internal-use-tools" )
333+ extra_files_str = repr (":internal-use-tools" if bazel_features . rules . merkle_cache_v2 else ":internal-use-tools-legacy" )
333334
334335 # C++ built-in include directories.
335336 # This contains both the includes shipped with the compiler as well as the sysroot (or host)
@@ -506,7 +507,7 @@ filegroup(name = "strip-files-{suffix}", srcs = [{extra_files_str}])
506507 template = template + """
507508filegroup(
508509 name = "cxx_builtin_include_files-{suffix}",
509- srcs = ["{llvm_dist_label_prefix}cxx_builtin_include "],
510+ srcs = ["{llvm_dist_label_prefix}{cxx_builtin_include_label} "],
510511)
511512
512513filegroup(
@@ -526,7 +527,7 @@ filegroup(
526527 "{llvm_dist_label_prefix}clang",
527528 "{llvm_dist_label_prefix}ld",
528529 "{llvm_dist_label_prefix}ar",
529- "{llvm_dist_label_prefix}lib ",
530+ "{llvm_dist_label_prefix}{lib_label} ",
530531 ":sysroot-components-{suffix}",
531532 ],
532533)
@@ -629,6 +630,8 @@ cc_toolchain(
629630 extra_unfiltered_compile_flags = _list_to_string (_dict_value (toolchain_info .extra_unfiltered_compile_flags_dict , target_pair )),
630631 extra_files_str = extra_files_str ,
631632 cxx_builtin_include_directories = _list_to_string (filtered_cxx_builtin_include_directories ),
633+ cxx_builtin_include_label = "cxx_builtin_include" if bazel_features .rules .merkle_cache_v2 else "include" ,
634+ lib_label = "lib" if bazel_features .rules .merkle_cache_v2 else "lib_legacy" ,
632635 extra_compiler_files = ("\" %s\" ," % str (toolchain_info .extra_compiler_files )) if toolchain_info .extra_compiler_files else "" ,
633636 major_llvm_version = major_llvm_version ,
634637 extra_exec_compatible_with_specific = toolchain_info .extra_exec_compatible_with .get (target_pair , []),
0 commit comments