authorgravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2023-04-13 19:37:55+02:00
committergravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2023-04-14 15:25:42+02:00
logd755f67b93dc795d27ea7df9b3bccda443f2a257
tree3fe5aee31dfbd0e07629d33ccbcce15207c65155
parentb42562be74ee7b88e39edc757643444de63d2df5
signaturelock-open Commit is signed but in an unrecognized format.

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.

1 files changed, 0 insertions(+), 19 deletions(-)

lib/std/start.zig-19
...@@ -18,7 +18,6 @@ const start_sym_name = if (native_arch.isMIPS()) "__start" else "_start";...@@ -18,7 +18,6 @@ const start_sym_name = if (native_arch.isMIPS()) "__start" else "_start";
18// Until then, we have simplified logic here for self-hosted. TODO remove this once18// Until then, we have simplified logic here for self-hosted. TODO remove this once
19// self-hosted is capable enough to handle all of the real start.zig logic.19// self-hosted is capable enough to handle all of the real start.zig logic.
20pub const simplified_logic =20pub const simplified_logic =
21 builtin.zig_backend == .stage2_wasm or
22 (builtin.zig_backend == .stage2_x86_64 and (builtin.link_libc or builtin.os.tag == .plan9)) or21 (builtin.zig_backend == .stage2_x86_64 and (builtin.link_libc or builtin.os.tag == .plan9)) or
23 builtin.zig_backend == .stage2_x86 or22 builtin.zig_backend == .stage2_x86 or
24 builtin.zig_backend == .stage2_aarch64 or23 builtin.zig_backend == .stage2_aarch64 or
...@@ -43,8 +42,6 @@ comptime {...@@ -43,8 +42,6 @@ comptime {
43 if (!@hasDecl(root, "wWinMainCRTStartup") and !@hasDecl(root, "mainCRTStartup")) {42 if (!@hasDecl(root, "wWinMainCRTStartup") and !@hasDecl(root, "mainCRTStartup")) {
44 @export(wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" });43 @export(wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" });
45 }44 }
46 } else if (builtin.os.tag == .wasi and @hasDecl(root, "main")) {
47 @export(wasiMain2, .{ .name = "_start" });
48 } else if (builtin.os.tag == .opencl) {45 } else if (builtin.os.tag == .opencl) {
49 if (@hasDecl(root, "main"))46 if (@hasDecl(root, "main"))
50 @export(spirvMain2, .{ .name = "main" });47 @export(spirvMain2, .{ .name = "main" });
...@@ -116,22 +113,6 @@ fn callMain2() noreturn {...@@ -116,22 +113,6 @@ fn callMain2() noreturn {
116 exit2(0);113 exit2(0);
117}114}
118115
119fn wasiMain2() callconv(.C) noreturn {
120 switch (@typeInfo(@typeInfo(@TypeOf(root.main)).Fn.return_type.?)) {
121 .Void => {
122 root.main();
123 std.os.wasi.proc_exit(0);
124 },
125 .Int => |info| {
126 if (info.bits != 8 or info.signedness == .signed) {
127 @compileError(bad_main_ret);
128 }
129 std.os.wasi.proc_exit(root.main());
130 },
131 else => @compileError("Bad return type main"),
132 }
133}
134
135fn spirvMain2() callconv(.Kernel) void {116fn spirvMain2() callconv(.Kernel) void {
136 root.main();117 root.main();
137}118}