-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcc-m1.patch
110 lines (99 loc) · 4.85 KB
/
cc-m1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Roughly based off of https://github.com/grailbio/bazel-toolchain/issues/88#issuecomment-1282357734
# with an additional patch to fix the strip_prefix for the unknown-linux-gnu-rhel86 toolchain build
diff --git a/toolchain/cc_toolchain_config.bzl b/toolchain/cc_toolchain_config.bzl
index 8785a8e..1ac65a5 100644
--- a/toolchain/cc_toolchain_config.bzl
+++ b/toolchain/cc_toolchain_config.bzl
@@ -68,6 +68,15 @@ def cc_toolchain_config(
"clang",
"darwin_x86_64",
"darwin_x86_64",
+ ),
+ "darwin-aarch64": (
+ "clang-aarch64-darwin",
+ "aarch64-apple-macosx",
+ "darwin",
+ "macosx",
+ "clang",
+ "darwin_aarch64",
+ "darwin_aarch64",
),
"linux-aarch64": (
"clang-aarch64-linux",
diff --git a/toolchain/internal/common.bzl b/toolchain/internal/common.bzl
index 7493c64..53b3b53 100644
--- a/toolchain/internal/common.bzl
+++ b/toolchain/internal/common.bzl
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SUPPORTED_TARGETS = [("linux", "x86_64"), ("linux", "aarch64"), ("darwin", "x86_64")]
+SUPPORTED_TARGETS = [("linux", "x86_64"), ("linux", "aarch64"), ("darwin", "x86_64"), ("darwin", "aarch64")]
host_tool_features = struct(
SUPPORTS_ARG_FILE = "supports_arg_file",
@@ -68,7 +68,10 @@ def arch(rctx):
])
if exec_result.return_code:
fail("Failed to detect machine architecture: \n%s\n%s" % (exec_result.stdout, exec_result.stderr))
- return exec_result.stdout.strip()
+ arch = exec_result.stdout.strip()
+ if arch == "arm64":
+ return "aarch64"
+ return arch
def os_arch_pair(os, arch):
return "{}-{}".format(os, arch)
diff --git a/toolchain/internal/llvm_distributions.bzl b/toolchain/internal/llvm_distributions.bzl
index 074ed84..62011f3 100644
--- a/toolchain/internal/llvm_distributions.bzl
+++ b/toolchain/internal/llvm_distributions.bzl
@@ -207,6 +207,12 @@ _llvm_distributions = {
"clang+llvm-14.0.0-x86_64-apple-darwin.tar.xz": "cf5af0f32d78dcf4413ef6966abbfd5b1445fe80bba57f2ff8a08f77e672b9b3",
"clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz": "61582215dafafb7b576ea30cc136be92c877ba1f1c31ddbbd372d6d65622fef5",
"clang+llvm-14.0.0-x86_64-linux-sles12.4.tar.xz": "78f70cc94c3b6f562455b15cebb63e75571d50c3d488d53d9aa4cd9dded30627",
+
+ # 15.0.2
+ "clang+llvm-15.0.2-arm64-apple-darwin21.0.tar.xz": "8c33f807bca56568b7060d0474daf63c8c10ec521d8188ac76362354d313ec58",
+ "clang+llvm-15.0.2-x86_64-apple-darwin.tar.xz": "a37ec6204f555605fa11e9c0e139a251402590ead6e227fc72da193e03883882",
+ "clang+llvm-15.0.2-aarch64-linux-gnu.tar.xz": "527ed550784681f95ec7a1be8fbf5a24bd03d7da9bf31afb6523996f45670be3",
+ "clang+llvm-15.0.2-x86_64-unknown-linux-gnu-rhel86.tar.xz": "f48f479e91ee7297ed8306c9d4495015691237cd91cc5330d3e1ee057b0548bd",
}
# Note: Unlike the user-specified llvm_mirror attribute, the URL prefixes in
@@ -229,6 +235,7 @@ _llvm_distributions_base_url = {
"13.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
"13.0.1": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
"14.0.0": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
+ "15.0.2": "https://github.com/llvm/llvm-project/releases/download/llvmorg-",
}
def _get_auth(ctx, urls):
@@ -310,6 +317,9 @@ def _distribution_urls(rctx):
strip_prefix = basename[:(len(basename) - len(".tar.xz"))]
+ if strip_prefix == "clang+llvm-15.0.2-x86_64-unknown-linux-gnu-rhel86":
+ strip_prefix = "clang+llvm-15.0.2-x86_64-unknown-linux-gnu"
+
return urls, sha256, strip_prefix
def _host_os_key(rctx):
diff --git a/toolchain/tools/llvm_release_name.py b/toolchain/tools/llvm_release_name.py
index 39505cc..3485d61 100755
--- a/toolchain/tools/llvm_release_name.py
+++ b/toolchain/tools/llvm_release_name.py
@@ -30,7 +30,12 @@ def _patch_llvm_version(llvm_version):
def _darwin(llvm_version, arch):
major_llvm_version = _major_llvm_version(llvm_version)
- suffix = "darwin-apple" if major_llvm_version == 9 else "apple-darwin"
+ if major_llvm_version == 9:
+ suffix = "darwin-apple"
+ elif arch == "arm64":
+ suffix = "apple-darwin21.0"
+ else:
+ suffix = "apple-darwin"
return "clang+llvm-{llvm_version}-{arch}-{suffix}.tar.xz".format(
llvm_version=llvm_version, arch=arch, suffix=suffix)
@@ -86,6 +91,8 @@ def _linux(llvm_version, distname, version, arch):
# If you find this mapping wrong, please send a Pull Request on Github.
if arch in ["aarch64", "armv7a", "mips", "mipsel"]:
os_name = "linux-gnu"
+ elif major_llvm_version == 15:
+ os_name = "unknown-linux-gnu-rhel86"
elif distname == "freebsd":
os_name = "unknown-freebsd-%s" % version
elif distname == "suse":