Skip to content

Commit 698aa15

Browse files
committed
Add toolchain to build aarch64 using clang-16
As TensorFlow is moving to build releases with clang it would be best to build IO with clang also.
1 parent 1be45af commit 698aa15

File tree

3 files changed

+498
-0
lines changed

3 files changed

+498
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copyright 2016 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This becomes the BUILD file for @local_config_cc// under non-FreeBSD unixes.
16+
17+
package(default_visibility = ["//visibility:public"])
18+
19+
load(":cc_toolchain_config.bzl", "cc_toolchain_config")
20+
21+
licenses(["notice"]) # Apache 2.0
22+
23+
cc_library(
24+
name = "malloc",
25+
)
26+
27+
filegroup(
28+
name = "empty",
29+
srcs = [],
30+
)
31+
32+
filegroup(
33+
name = "compiler_deps",
34+
srcs = glob(["extra_tools/**"]) + [":empty"],
35+
)
36+
37+
# This is the entry point for --crosstool_top. Toolchains are found
38+
# by lopping off the name of --crosstool_top and searching for
39+
# the "${CPU}" entry in the toolchains attribute.
40+
cc_toolchain_suite(
41+
name = "toolchain",
42+
toolchains = {
43+
"local|compiler": ":cc-clang-compiler-aarch64",
44+
"aarch64": ":cc-clang-compiler-aarch64",
45+
},
46+
)
47+
48+
cc_toolchain(
49+
name = "cc-clang-compiler-aarch64",
50+
all_files = ":compiler_deps",
51+
ar_files = ":empty",
52+
as_files = ":empty",
53+
compiler_files = ":compiler_deps",
54+
dwp_files = ":empty",
55+
linker_files = ":compiler_deps",
56+
objcopy_files = ":empty",
57+
strip_files = ":empty",
58+
supports_param_files = 1,
59+
toolchain_config = ":linux_clang_aarch64",
60+
toolchain_identifier = "linux_clang_aarch64",
61+
)
62+
63+
cc_toolchain_config(
64+
name = "linux_clang_aarch64",
65+
compiler = "/usr/lib/llvm-16/bin/clang",
66+
cpu = "aarch64",
67+
)
68+
69+
toolchain(
70+
name = "cc-toolchain-clang-aarch64",
71+
exec_compatible_with = [
72+
# TODO(katre): add autodiscovered constraints for host CPU and OS.
73+
],
74+
target_compatible_with = [
75+
# TODO(katre): add autodiscovered constraints for host CPU and OS.
76+
],
77+
toolchain = ":cc-clang-compiler-aarch64",
78+
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
79+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# DO NOT EDIT: automatically generated WORKSPACE file for cc_autoconf rule
2+
workspace(name = "local_config_cc")

0 commit comments

Comments
 (0)