Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b2f7dd3
Add support for Windows target and host
ArchangelX360 Dec 5, 2025
ea004bd
Disable `cxx_builtin_include_directories` temporarily for Windows target
ArchangelX360 Dec 18, 2025
14e160f
Clean TODOs
ArchangelX360 Dec 18, 2025
b03daa2
Clarify TODOs
ArchangelX360 Dec 18, 2025
7e4b81a
Ensure backward compatibility with custom-build LLVM toolchains
ArchangelX360 Dec 21, 2025
c16ca8a
Use a more idiomatic key mutation (review comment)
ArchangelX360 Dec 21, 2025
a864350
Remove UNIX specific libraires from Windows repo toolchain (review co…
ArchangelX360 Dec 21, 2025
7dcecbc
Remove Windows libclang, never relevant
ArchangelX360 Dec 21, 2025
f8e038e
Fix comments
ArchangelX360 Dec 21, 2025
944bd4c
Fix cross-compilation `gcc` tool call on Windows
ArchangelX360 Dec 21, 2025
96cdedd
Fix backward compatibility with eventual custom LLVM toolchains
ArchangelX360 Dec 22, 2025
e68cd8f
Drop support for `lib_legacy` on Windows hosts
ArchangelX360 Dec 22, 2025
9738102
Fix missing `.pdb` generation required by cc_rules in `debug` and `fa…
ArchangelX360 Jan 7, 2026
5060128
Remove redundant `--target` flag (not understood by `lld-link` linker
ArchangelX360 Jan 7, 2026
01fcd66
Reason about `linker` in `cc_toolchain_config` instead of compiler in…
ArchangelX360 Jan 7, 2026
fba4161
Fix cross-compilation to MSVC and clarify branches
ArchangelX360 Jan 7, 2026
186793f
Drop `lib/clang/{LLVM_VERSION}/lib` libraries
ArchangelX360 Jan 8, 2026
42546c7
Reason using abi instead of os target for `gcc_tool` to reflect reality
ArchangelX360 Jan 9, 2026
ef8695d
Sanitize reproducer
ArchangelX360 Jan 9, 2026
9f46c1c
Refactor tool path string building
ArchangelX360 Jan 9, 2026
e184349
Fix cross-compilation from Linux to Windows and macOS
ArchangelX360 Dec 23, 2025
35b69ad
Fix typo in passed Windows compiler args
pikinier20 Feb 11, 2026
1cfb221
Do not set `-no-canonical-prefixes` when cross-compiling to Windows
ArchangelX360 Feb 11, 2026
27c0bc7
Add TODO
ArchangelX360 Feb 11, 2026
49fa778
Add an alias for llvm-rc tool in order to be able to reuse LLVM to co…
pikinier20 Feb 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions platforms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,19 @@ platform(
"@platforms//cpu:wasm64",
],
)

platform(
name = "windows-x86_64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
)

platform(
name = "windows-aarch64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:aarch64",
],
)
16 changes: 11 additions & 5 deletions toolchain/BUILD.llvm_repo.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ exports_files(glob(
filegroup(
name = "clang",
srcs = [
"bin/clang",
"bin/clang++",
"bin/clang-cpp",
],
"bin/clang",
"bin/clang++",
"bin/clang-cpp",
] + glob([
"bin/clang-cl",
"bin/lld-link",
Comment thread
ArchangelX360 marked this conversation as resolved.
], allow_empty = True),
)

filegroup(
Expand All @@ -42,7 +45,10 @@ filegroup(
srcs = [
"bin/ld.lld",
"bin/ld64.lld",
] + glob(["bin/wasm-ld"], allow_empty = True),
] + glob([
"bin/wasm-ld",
"bin/lld-link",
Comment thread
ArchangelX360 marked this conversation as resolved.
], allow_empty = True),
)

filegroup(
Expand Down
209 changes: 209 additions & 0 deletions toolchain/BUILD.llvm_repo_windows.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# Copyright 2021 The Bazel Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

package(default_visibility = ["//visibility:public"])

# Some targets may need to directly depend on these files.
exports_files(glob(
[
"bin/*",
"lib/**",
"include/**",
"share/clang/*",
],
allow_empty = True,
))

## LLVM toolchain files

ALL_DLLS = glob(["bin/*.dll"], allow_empty=True)

filegroup(
name = "clang",
srcs = [
"bin/clang.exe",
"bin/clang++.exe",
"bin/clang-cpp.exe",
"bin/clang-cl.exe",
"bin/lld-link.exe",
] + ALL_DLLS,
)

filegroup(
name = "ld",
# Not all distributions contain wasm-ld.
srcs = [
"bin/ld.lld.exe",
"bin/ld64.lld.exe",
] + ALL_DLLS,
)

filegroup(
name = "include",
srcs = glob(
[
"include/**/c++/**",
"lib/clang/*/include/**",
],
),
)

filegroup(
name = "all_includes",
srcs = glob(
["include/**"],
allow_empty = True,
),
)

# This filegroup should only have source directories, not individual files.
# We rely on this assumption in system_module_map.bzl.
filegroup(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fmeum any FUD around source directories on windows?

name = "cxx_builtin_include",
srcs = [
"include/c++",
"lib/clang/{LLVM_VERSION}/include",
],
)

filegroup(
name = "extra_config_site",
srcs = glob(["include/*/c++/v1/__config_site"], allow_empty = True)
)

filegroup(
name = "bin",
srcs = glob(["bin/**"]),
)

filegroup(
name = "lib",
srcs = [],
)

filegroup(
name = "lib_legacy",
srcs = [], # no reported Windows exec usage on older version of Bazel
)

filegroup(
name = "ar",
srcs = [
"bin/llvm-ar.exe",
] + ALL_DLLS,
)

filegroup(
name = "as",
srcs = [
"bin/clang.exe",
"bin/llvm-as.exe",
] + ALL_DLLS,
)

filegroup(
name = "nm",
srcs = [
"bin/llvm-nm.exe",
] + ALL_DLLS,
)

filegroup(
name = "llvm-lib",
srcs = [
"bin/llvm-lib.exe",
] + ALL_DLLS,
)

filegroup(
name = "objcopy",
srcs = [
"bin/llvm-objcopy.exe",
] + ALL_DLLS,
)

filegroup(
name = "objdump",
srcs = [
"bin/llvm-objdump.exe",
] + ALL_DLLS,
)

filegroup(
name = "profdata",
srcs = [
"bin/llvm-profdata.exe",
] + ALL_DLLS,
)

filegroup(
name = "dwp",
srcs = [
"bin/llvm-dwp.exe",
] + ALL_DLLS,
)

filegroup(
name = "ranlib",
srcs = [
"bin/llvm-ranlib.exe",
] + ALL_DLLS,
)

filegroup(
name = "readelf",
srcs = [
"bin/llvm-readelf.exe",
] + ALL_DLLS,
)

filegroup(
name = "strip",
srcs = [
"bin/llvm-strip.exe",
] + ALL_DLLS,
)

filegroup(
name = "symbolizer",
srcs = [
"bin/llvm-symbolizer.exe",
] + ALL_DLLS,
)

filegroup(
name = "clang-tidy",
srcs = [
"bin/clang-tidy.exe",
] + ALL_DLLS,
)

filegroup(
name = "clang-format",
srcs = [
"bin/clang-format.exe",
] + ALL_DLLS,
)

filegroup(
name = "git-clang-format",
srcs = [
"bin/git-clang-format.exe",
] + ALL_DLLS,
)

filegroup(
name = "libclang",
srcs = ["lib/libclang.lib"],
)
1 change: 1 addition & 0 deletions toolchain/aliases.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ aliased_tools = [
"llvm-cov",
"llvm-profdata",
"llvm-symbolizer",
"llvm-rc",
]
Loading