Skip to content

Commit 8b06fed

Browse files
committed
BRT modifications
This is a combination of things I mentioned in #90 and hacks for things specific to our environment. Putting it all in a commit to start a discussion, I'm going to split out the pieces that make sense later.
1 parent 9b0bae6 commit 8b06fed

9 files changed

+615
-186
lines changed

toolchain/BUILD.bazel

+8
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ exports_files(
2121
exclude = ["BUILD.bazel"],
2222
),
2323
)
24+
25+
filegroup(
26+
name = "blacklists",
27+
srcs = [
28+
"msan-blacklist",
29+
],
30+
visibility = ["//visibility:public"],
31+
)

toolchain/BUILD.tpl

+37-64
Original file line numberDiff line numberDiff line change
@@ -33,63 +33,12 @@ filegroup(
3333

3434
filegroup(
3535
name = "sysroot_components",
36-
srcs = [%{sysroot_label}],
36+
srcs = %{sysroot_labels},
3737
)
3838

39-
cc_toolchain_suite(
40-
name = "toolchain",
41-
toolchains = {
42-
"k8|clang": ":cc-clang-linux",
43-
"darwin|clang": ":cc-clang-darwin",
44-
"k8": ":cc-clang-linux",
45-
"darwin": ":cc-clang-darwin",
46-
},
47-
)
48-
49-
load(":cc_toolchain_config.bzl", "cc_toolchain_config")
50-
51-
cc_toolchain_config(
52-
name = "local_linux",
53-
cpu = "k8",
54-
)
55-
56-
cc_toolchain_config(
57-
name = "local_darwin",
58-
cpu = "darwin",
59-
)
60-
61-
toolchain(
62-
name = "cc-toolchain-darwin",
63-
exec_compatible_with = [
64-
"@platforms//cpu:x86_64",
65-
"@platforms//os:osx",
66-
],
67-
target_compatible_with = [
68-
"@platforms//cpu:x86_64",
69-
"@platforms//os:osx",
70-
],
71-
toolchain = ":cc-clang-darwin",
72-
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
73-
)
74-
75-
toolchain(
76-
name = "cc-toolchain-linux",
77-
exec_compatible_with = [
78-
"@platforms//cpu:x86_64",
79-
"@platforms//os:linux",
80-
],
81-
target_compatible_with = [
82-
"@platforms//cpu:x86_64",
83-
"@platforms//os:linux",
84-
],
85-
toolchain = ":cc-clang-linux",
86-
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
87-
)
88-
89-
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "conditional_cc_toolchain")
39+
load(":cc_toolchain_config.bzl", "do_toolchain_configs")
9040

91-
conditional_cc_toolchain("cc-clang-linux", False, %{absolute_paths})
92-
conditional_cc_toolchain("cc-clang-darwin", True, %{absolute_paths})
41+
do_toolchain_configs()
9342

9443
## LLVM toolchain files
9544
# Needed when not using absolute paths.
@@ -115,22 +64,24 @@ filegroup(
11564
filegroup(
11665
name = "include",
11766
srcs = glob([
118-
"include/c++/**",
119-
"lib/clang/%{llvm_version}/include/**",
120-
]),
67+
"libcxx-*/include/c++/**",
68+
] + ["%sinclude/c++/**" % maybe_target for maybe_target in %{all_maybe_target}]
69+
+ ["%slib/clang/%{llvm_version}/include/**" % maybe_target for maybe_target in %{all_maybe_target}]
70+
),
12171
)
12272

12373
filegroup(
12474
name = "lib",
12575
srcs = glob(
12676
[
127-
"lib/lib*.a",
128-
"lib/clang/%{llvm_version}/lib/**/*.a",
129-
],
77+
"libcxx-*/lib/lib*.a",
78+
] + ["%slib/lib*.a" % maybe_target for maybe_target in %{all_maybe_target}]
79+
+ ["%slib/clang/%{llvm_version}/lib/**/*.a" % maybe_target for maybe_target in %{all_maybe_target}]
80+
+ ["%slib/clang/%{llvm_version}/lib/**/*.a.syms" % maybe_target for maybe_target in %{all_maybe_target}],
13081
exclude = [
131-
"lib/libLLVM*.a",
132-
"lib/libclang*.a",
133-
"lib/liblld*.a",
82+
"**/lib/libLLVM*.a",
83+
"**/lib/libclang*.a",
84+
"**/lib/liblld*.a",
13485
],
13586
),
13687
)
@@ -141,7 +92,8 @@ filegroup(
14192
":clang",
14293
":include",
14394
":sysroot_components",
144-
],
95+
"@com_grail_bazel_toolchain//toolchain:blacklists",
96+
] + %{cuda_path_labels},
14597
)
14698

14799
filegroup(
@@ -167,6 +119,11 @@ filegroup(
167119
srcs = ["bin/llvm-objcopy"],
168120
)
169121

122+
filegroup(
123+
name = "strip",
124+
srcs = ["bin/llvm-strip"],
125+
)
126+
170127
filegroup(
171128
name = "objdump",
172129
srcs = ["bin/llvm-objdump"],
@@ -192,6 +149,21 @@ filegroup(
192149
srcs = ["bin/llvm-readelf"],
193150
)
194151

152+
filegroup(
153+
name = "clang-format",
154+
srcs = ["bin/clang-format"],
155+
)
156+
157+
filegroup(
158+
name = "git-clang-format",
159+
srcs = ["bin/git-clang-format"],
160+
)
161+
162+
sh_binary(
163+
name = "llvm-cov",
164+
srcs = ["bin/llvm-cov"],
165+
)
166+
195167
filegroup(
196168
name = "binutils_components",
197169
srcs = glob(["bin/*"]),
@@ -205,6 +177,7 @@ filegroup(
205177
":ar",
206178
":lib",
207179
":sysroot_components",
180+
"@com_grail_bazel_toolchain//toolchain:blacklists",
208181
],
209182
)
210183

0 commit comments

Comments
 (0)