Skip to content

Commit b1e6c76

Browse files
authored
Update and extend clang20 (#203)
* Provide `clang20` toolchains for `graviton2` and `graviton3`
1 parent 3d7491c commit b1e6c76

File tree

12 files changed

+491
-91
lines changed

12 files changed

+491
-91
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Run format
2525
run: |
26-
bazel run //:buildifier
26+
bazel run //tools/buildifier:buildifier
2727
git diff --exit-code
2828
2929
example-small-world:
@@ -47,5 +47,6 @@ jobs:
4747
4848
- name: Run format
4949
run: |
50-
bazel run //:buildifier
50+
cd examples/small_world
51+
bazel run //tools/buildifier:buildifier
5152
git diff --exit-code

BUILD.bazel

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
2-
3-
buildifier(
4-
name = "buildifier",
5-
)

MODULE.bazel

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010

1111
module(
1212
name = "rules_swiftnav",
13-
version = "0.10.0",
13+
version = "0.11.0",
1414
compatibility_level = 1,
1515
)
1616

1717
# Core Bazel dependencies
18-
bazel_dep(name = "bazel_skylib", version = "1.7.1")
19-
bazel_dep(name = "platforms", version = "0.0.11")
20-
bazel_dep(name = "rules_cc", version = "0.1.1")
21-
bazel_dep(name = "rules_pkg", version = "1.0.1")
22-
bazel_dep(name = "rules_oci", version = "1.0.0")
18+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
19+
bazel_dep(name = "platforms", version = "1.0.0")
20+
bazel_dep(name = "rules_cc", version = "0.2.14")
21+
bazel_dep(name = "rules_pkg", version = "1.1.0")
22+
bazel_dep(name = "rules_oci", version = "1.8.0")
2323

2424
# Register module extensions
2525
swift_cc_toolchain_ext = use_extension("@rules_swiftnav//cc:extensions.bzl", "swift_cc_toolchain_extension")

MODULE.bazel.lock

Lines changed: 203 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cc/toolchains/llvm/x86_64-aarch64-linux/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ cc_toolchain_config(
115115
"//conditions:default": [],
116116
}),
117117
host_system_name = X86_64_LINUX,
118-
target_cpu = "k8",
118+
target_cpu = "k8", # this should be aarch64?
119119
target_libc = "glibc_unknown",
120120
target_system_name = AARCH64_LINUX,
121121
tool_paths = {
@@ -125,7 +125,7 @@ cc_toolchain_config(
125125
"gcov": "wrappers/llvm-profdata",
126126
"llvm-cov": "wrappers/llvm-cov",
127127
"llvm-profdata": "wrappers/llvm-profdata",
128-
"ld": "wrappers/ld.ldd",
128+
"ld": "wrappers/ld.ldd", # This should be ld.lld?
129129
"nm": "wrappers/llvm-nm",
130130
"objcopy": "wrappers/llvm-objcopy",
131131
"objdump": "wrappers/llvm-objdump",

cc/toolchains/llvm20/x86_64-aarch64-linux/BUILD.bazel

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,18 @@ cc_toolchain_config(
102102
abi_libc_version = "glibc_unknown",
103103
abi_version = "clang",
104104
builtin_sysroot = select({
105-
# _use_libcpp case needs to be implemented properly here!
105+
"@rules_swiftnav//cc:_use_libcpp": None,
106106
"//conditions:default": "external/rules_swiftnav++swift_cc_toolchain_extension+aarch64-sysroot",
107107
}),
108108
compiler = "clang",
109109
cxx_builtin_include_directories = [
110110
"%sysroot%/usr/include",
111111
],
112+
extra_copts = select({
113+
"@rules_swiftnav//cc/constraints:graviton2": ["-mcpu=neoverse-n1"],
114+
"@rules_swiftnav//cc/constraints:graviton3": ["-mcpu=neoverse-512tvb"],
115+
"//conditions:default": [],
116+
}),
112117
host_system_name = X86_64_LINUX,
113118
target_cpu = "aarch64",
114119
target_libc = "glibc_unknown",
@@ -158,3 +163,39 @@ toolchain(
158163
toolchain = ":cc-clang-x86_64-aarch64-linux",
159164
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
160165
)
166+
167+
toolchain(
168+
name = "cc-toolchain-aarch64-bullseye-graviton2",
169+
exec_compatible_with = [
170+
"@platforms//cpu:x86_64",
171+
"@platforms//os:linux",
172+
],
173+
target_compatible_with = [
174+
"@platforms//os:linux",
175+
"@platforms//cpu:aarch64",
176+
"@rules_swiftnav//cc/constraints:glibc_2_31",
177+
"@rules_swiftnav//cc/constraints:graviton2",
178+
"@rules_swiftnav//cc/constraints:llvm20_toolchain",
179+
],
180+
target_settings = None,
181+
toolchain = ":cc-clang-x86_64-aarch64-linux",
182+
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
183+
)
184+
185+
toolchain(
186+
name = "cc-toolchain-aarch64-bullseye-graviton3",
187+
exec_compatible_with = [
188+
"@platforms//cpu:x86_64",
189+
"@platforms//os:linux",
190+
],
191+
target_compatible_with = [
192+
"@platforms//os:linux",
193+
"@platforms//cpu:aarch64",
194+
"@rules_swiftnav//cc/constraints:glibc_2_31",
195+
"@rules_swiftnav//cc/constraints:graviton3",
196+
"@rules_swiftnav//cc/constraints:llvm20_toolchain",
197+
],
198+
target_settings = None,
199+
toolchain = ":cc-clang-x86_64-aarch64-linux",
200+
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
201+
)

examples/small_world/BUILD.bazel

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
2-
3-
buildifier(
4-
name = "buildifier",
5-
)

examples/small_world/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module(name = "small_world")
22

3-
bazel_dep(name = "platforms", version = "0.0.11")
3+
bazel_dep(name = "platforms", version = "1.0.0")
44
bazel_dep(name = "rules_swiftnav")
55
local_path_override(
66
module_name = "rules_swiftnav",

0 commit comments

Comments
 (0)