@@ -135,10 +135,6 @@ def llvm_config_impl(rctx):
135135 tools = _toolchain_tools (os )
136136 for tool_name , symlink_name in tools .items ():
137137 rctx .symlink (llvm_dist_rel_path + "bin/" + tool_name , tools_path_prefix + symlink_name )
138- symlinked_tools_str = "" .join ([
139- "\n " + (" " * 8 ) + "\" " + tools_path_prefix + symlink_name + "\" ,"
140- for symlink_name in tools .values ()
141- ])
142138 else :
143139 llvm_dist_rel_path = llvm_dist_path_prefix
144140 llvm_dist_label_prefix = llvm_dist_path_prefix
@@ -147,7 +143,6 @@ def llvm_config_impl(rctx):
147143 # No symlinking necessary when using absolute paths.
148144 wrapper_bin_prefix = "bin/"
149145 tools_path_prefix = llvm_dist_path_prefix + "bin/"
150- symlinked_tools_str = ""
151146
152147 sysroot_paths_dict , sysroot_labels_dict = _sysroot_paths_dict (
153148 rctx ,
@@ -230,8 +225,7 @@ def llvm_config_impl(rctx):
230225 {
231226 "%{cc_toolchain_config_bzl}" : str (rctx .attr ._cc_toolchain_config_bzl ),
232227 "%{cc_toolchains}" : cc_toolchains_str ,
233- "%{symlinked_tools}" : symlinked_tools_str ,
234- "%{wrapper_bin_prefix}" : wrapper_bin_prefix ,
228+ "%{tools_dir}" : wrapper_bin_prefix .removesuffix ("/" ),
235229 "%{convenience_targets}" : convenience_targets_str ,
236230 },
237231 )
@@ -335,7 +329,7 @@ def _cc_toolchain_str(
335329 # TODO: Are there other situations where we can continue?
336330 return ""
337331
338- extra_files_str = " \" :internal-use-files \" "
332+ extra_files_str = repr ( " :internal-use-tools" )
339333
340334 # C++ built-in include directories.
341335 # This contains both the includes shipped with the compiler as well as the sysroot (or host)
@@ -360,15 +354,12 @@ def _cc_toolchain_str(
360354 "wasip1-wasm32" : "wasm32-wasip1" ,
361355 "wasip1-wasm64" : "wasm64-wasip1" ,
362356 }[target_pair ]
357+
363358 cxx_builtin_include_directories = [
364359 toolchain_path_prefix + "include/c++/v1" ,
365- toolchain_path_prefix + "include/{}/c++/v1" .format (target_system_name ),
366- toolchain_path_prefix + "lib/clang/{}/include" .format (llvm_version ),
367- toolchain_path_prefix + "lib/clang/{}/share" .format (llvm_version ),
368- toolchain_path_prefix + "lib64/clang/{}/include" .format (llvm_version ),
369- toolchain_path_prefix + "lib/clang/{}/include" .format (major_llvm_version ),
370- toolchain_path_prefix + "lib/clang/{}/share" .format (major_llvm_version ),
371- toolchain_path_prefix + "lib64/clang/{}/include" .format (major_llvm_version ),
360+ toolchain_path_prefix + "lib/clang/{}/include" .format (
361+ major_llvm_version if major_llvm_version >= 16 else llvm_version ,
362+ ),
372363 ]
373364
374365 sysroot_prefix = ""
@@ -505,17 +496,15 @@ filegroup(name = "strip-files-{suffix}", srcs = [{extra_files_str}])
505496 template = template + """
506497filegroup(
507498 name = "cxx_builtin_include_files-{suffix}",
508- srcs = [
509- "{llvm_dist_label_prefix}clang",
510- "{llvm_dist_label_prefix}include",
511- ],
499+ srcs = ["{llvm_dist_label_prefix}cxx_builtin_include"],
512500)
513501
514502filegroup(
515503 name = "compiler-components-{suffix}",
516504 srcs = [
517505 ":cxx_builtin_include_files-{suffix}",
518506 ":sysroot-components-{suffix}",
507+ "{llvm_dist_label_prefix}clang",
519508 {extra_compiler_files}
520509 ],
521510)
0 commit comments