Skip to content

Commit 6c38d5e

Browse files
committed
feat: Add BPF triple constraint mapping
Add support for tier 3 targets bpfeb-unknown-none and bpfel-unknown-none (see https://github.com/rust-lang/rust/blob/f5e2df7/src/doc/rustc/src/platform-support.md?plain=1#L311-L312).
1 parent 71470d7 commit 6c38d5e

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module(
1111

1212
bazel_dep(name = "bazel_features", version = "1.32.0")
1313
bazel_dep(name = "bazel_skylib", version = "1.8.2")
14-
bazel_dep(name = "platforms", version = "1.0.0")
14+
bazel_dep(name = "platforms", version = "1.1.0")
1515
bazel_dep(name = "rules_cc", version = "0.2.4")
1616
bazel_dep(name = "rules_license", version = "1.0.0")
1717
bazel_dep(name = "rules_shell", version = "0.6.1")

rust/platform/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ package(default_visibility = ["//visibility:public"])
66
declare_config_settings()
77

88
# WASI Preview version constraint settings
9+
#
10+
# TODO(https://github.com/bazelbuild/platforms/pull/123): Replace with upstream.
911
constraint_setting(
1012
name = "wasi_version",
1113
default_constraint_value = ":wasi_preview_1",

rust/platform/triple_mappings.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ SUPPORTED_T2_PLATFORM_TRIPLES = {
8080

8181
_T3_PLATFORM_TRIPLES = {
8282
"aarch64-unknown-nto-qnx710": _support(std = True, host_tools = False),
83+
"bpfeb-unknown-none": _support(std = False, host_tools = False),
84+
"bpfel-unknown-none": _support(std = False, host_tools = False),
8385
"wasm64-unknown-unknown": _support(std = False, host_tools = False),
8486
}
8587

test/unit/platform_triple/platform_triple_test.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ def _construct_known_triples_test_impl(ctx):
127127
_assert_parts(env, triple("thumbv7em-none-eabihf"), "thumbv7em", None, "none", "eabihf")
128128
_assert_parts(env, triple("thumbv8m.main-none-eabi"), "thumbv8m.main", None, "none", "eabi")
129129

130+
# BPF targets
131+
_assert_parts(env, triple("bpfeb-unknown-none"), "bpfeb", "unknown", "none", None)
132+
_assert_parts(env, triple("bpfel-unknown-none"), "bpfel", "unknown", "none", None)
133+
130134
# Test all WASM32 targets
131135
_assert_parts(env, triple("wasm32-unknown-unknown"), "wasm32", "unknown", "unknown", None)
132136
_assert_parts(env, triple("wasm32-unknown-emscripten"), "wasm32", "unknown", "emscripten", None)

0 commit comments

Comments
 (0)