mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
wasm: no longer use simplified start.zig
The Wasm backend now supports all features required to use the full `start.zig` logic, rather than the simplified version. With this commit we remove all references to the simplified logic for Wasm specifically.
This commit is contained in:
parent
b42562be74
commit
d755f67b93
@ -18,7 +18,6 @@ const start_sym_name = if (native_arch.isMIPS()) "__start" else "_start";
|
|||||||
// Until then, we have simplified logic here for self-hosted. TODO remove this once
|
// Until then, we have simplified logic here for self-hosted. TODO remove this once
|
||||||
// self-hosted is capable enough to handle all of the real start.zig logic.
|
// self-hosted is capable enough to handle all of the real start.zig logic.
|
||||||
pub const simplified_logic =
|
pub const simplified_logic =
|
||||||
builtin.zig_backend == .stage2_wasm or
|
|
||||||
(builtin.zig_backend == .stage2_x86_64 and (builtin.link_libc or builtin.os.tag == .plan9)) or
|
(builtin.zig_backend == .stage2_x86_64 and (builtin.link_libc or builtin.os.tag == .plan9)) or
|
||||||
builtin.zig_backend == .stage2_x86 or
|
builtin.zig_backend == .stage2_x86 or
|
||||||
builtin.zig_backend == .stage2_aarch64 or
|
builtin.zig_backend == .stage2_aarch64 or
|
||||||
@ -43,8 +42,6 @@ comptime {
|
|||||||
if (!@hasDecl(root, "wWinMainCRTStartup") and !@hasDecl(root, "mainCRTStartup")) {
|
if (!@hasDecl(root, "wWinMainCRTStartup") and !@hasDecl(root, "mainCRTStartup")) {
|
||||||
@export(wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" });
|
@export(wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" });
|
||||||
}
|
}
|
||||||
} else if (builtin.os.tag == .wasi and @hasDecl(root, "main")) {
|
|
||||||
@export(wasiMain2, .{ .name = "_start" });
|
|
||||||
} else if (builtin.os.tag == .opencl) {
|
} else if (builtin.os.tag == .opencl) {
|
||||||
if (@hasDecl(root, "main"))
|
if (@hasDecl(root, "main"))
|
||||||
@export(spirvMain2, .{ .name = "main" });
|
@export(spirvMain2, .{ .name = "main" });
|
||||||
@ -116,22 +113,6 @@ fn callMain2() noreturn {
|
|||||||
exit2(0);
|
exit2(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wasiMain2() callconv(.C) noreturn {
|
|
||||||
switch (@typeInfo(@typeInfo(@TypeOf(root.main)).Fn.return_type.?)) {
|
|
||||||
.Void => {
|
|
||||||
root.main();
|
|
||||||
std.os.wasi.proc_exit(0);
|
|
||||||
},
|
|
||||||
.Int => |info| {
|
|
||||||
if (info.bits != 8 or info.signedness == .signed) {
|
|
||||||
@compileError(bad_main_ret);
|
|
||||||
}
|
|
||||||
std.os.wasi.proc_exit(root.main());
|
|
||||||
},
|
|
||||||
else => @compileError("Bad return type main"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn spirvMain2() callconv(.Kernel) void {
|
fn spirvMain2() callconv(.Kernel) void {
|
||||||
root.main();
|
root.main();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user