-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add wasm32-freestanding-none zig cc toolchain
- Loading branch information
Showing
6 changed files
with
120 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
diff --git a/toolchain/private/defs.bzl b/toolchain/private/defs.bzl | ||
index 716a3a3..33f1993 100644 | ||
--- a/toolchain/private/defs.bzl | ||
+++ b/toolchain/private/defs.bzl | ||
@@ -49,6 +49,7 @@ def target_structs(): | ||
for glibc in _GLIBCS: | ||
ret.append(_target_linux_gnu(gocpu, zigcpu, glibc)) | ||
ret.append(_target_wasm()) | ||
+ ret.append(_target_wasm_unknown()) | ||
return ret | ||
|
||
def _target_macos(gocpu, zigcpu): | ||
@@ -222,3 +223,23 @@ def _target_wasm(): | ||
ld_zig_subcmd = "wasm-ld", | ||
artifact_name_patterns = [], | ||
) | ||
+ | ||
+def _target_wasm_unknown(): | ||
+ return struct( | ||
+ gotarget = "wasm32-unknown-unknown", | ||
+ zigtarget = "wasm32-freestanding-none", | ||
+ includes = [ | ||
+ ] + _INCLUDE_TAIL, | ||
+ linkopts = [], | ||
+ dynamic_library_linkopts = [], | ||
+ supports_dynamic_linker = False, | ||
+ copts = [], | ||
+ libc = "musl", | ||
+ bazel_target_cpu = "wasm32", | ||
+ constraint_values = [ | ||
+ "@platforms//os:none", | ||
+ "@platforms//cpu:wasm32", | ||
+ ], | ||
+ ld_zig_subcmd = "wasm-ld", | ||
+ artifact_name_patterns = [], | ||
+ ) | ||
diff --git a/toolchain/zig-wrapper.zig b/toolchain/zig-wrapper.zig | ||
index d1d59f9..5e2984b 100644 | ||
--- a/toolchain/zig-wrapper.zig | ||
+++ b/toolchain/zig-wrapper.zig | ||
@@ -283,7 +283,7 @@ fn getRunMode(self_exe: []const u8, self_base_noexe: []const u8) error{BadParent | ||
return error.BadParent; | ||
|
||
const got_os = it.next() orelse return error.BadParent; | ||
- if (mem.indexOf(u8, "linux,macos,windows,wasi", got_os) == null) | ||
+ if (mem.indexOf(u8, "linux,macos,windows,wasi,freestanding", got_os) == null) | ||
return error.BadParent; | ||
|
||
// ABI triple is too much of a moving target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
diff --git a/extensions/wasm_bindgen/MODULE.bazel b/extensions/wasm_bindgen/MODULE.bazel | ||
index eba0d184..6da4e198 100644 | ||
--- a/extensions/wasm_bindgen/MODULE.bazel | ||
+++ b/extensions/wasm_bindgen/MODULE.bazel | ||
@@ -54,7 +54,7 @@ use_repo( | ||
|
||
register_toolchains( | ||
"//:default_wasm_bindgen_toolchain", | ||
- "@rules_rust//rust/private/dummy_cc_toolchain:dummy_cc_wasm32_toolchain", | ||
+ #"@rules_rust//rust/private/dummy_cc_toolchain:dummy_cc_wasm32_toolchain", | ||
"@rules_rust//rust/private/dummy_cc_toolchain:dummy_cc_wasm64_toolchain", | ||
) | ||
|
||
diff --git a/rust/private/dummy_cc_toolchain/BUILD.bazel b/rust/private/dummy_cc_toolchain/BUILD.bazel | ||
index df4290af..4a0dfa45 100644 | ||
--- a/rust/private/dummy_cc_toolchain/BUILD.bazel | ||
+++ b/rust/private/dummy_cc_toolchain/BUILD.bazel | ||
@@ -8,12 +8,12 @@ load(":dummy_cc_toolchain.bzl", "dummy_cc_config", "dummy_cc_toolchain") | ||
|
||
dummy_cc_toolchain(name = "dummy_cc_wasm") | ||
|
||
-toolchain( | ||
- name = "dummy_cc_wasm32_toolchain", | ||
- target_compatible_with = ["@platforms//cpu:wasm32"], | ||
- toolchain = ":dummy_cc_wasm_toolchain_cc", | ||
- toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | ||
-) | ||
+#toolchain( | ||
+# name = "dummy_cc_wasm32_toolchain", | ||
+# target_compatible_with = ["@platforms//cpu:wasm32"], | ||
+# toolchain = ":dummy_cc_wasm_toolchain_cc", | ||
+# toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | ||
+#) | ||
|
||
toolchain( | ||
name = "dummy_cc_wasm64_toolchain", | ||
diff --git a/rust/repositories.bzl b/rust/repositories.bzl | ||
index 06de237d..09566384 100644 | ||
--- a/rust/repositories.bzl | ||
+++ b/rust/repositories.bzl | ||
@@ -1218,7 +1218,7 @@ def rust_repository_set( | ||
# Register toolchains | ||
if register_toolchain: | ||
native.register_toolchains(*toolchain_labels) | ||
- native.register_toolchains(str(Label("//rust/private/dummy_cc_toolchain:dummy_cc_wasm32_toolchain"))) | ||
+ #native.register_toolchains(str(Label("//rust/private/dummy_cc_toolchain:dummy_cc_wasm32_toolchain"))) | ||
native.register_toolchains(str(Label("//rust/private/dummy_cc_toolchain:dummy_cc_wasm64_toolchain"))) | ||
|
||
return all_toolchain_details |