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";
1818// Until then, we have simplified logic here for self-hosted. TODO remove this once
1919// self-hosted is capable enough to handle all of the real start.zig logic.
2020pub const simplified_logic =
21 builtin.zig_backend == .stage2_wasm or
2221 (builtin.zig_backend == .stage2_x86_64 and (builtin.link_libc or builtin.os.tag == .plan9)) or
2322 builtin.zig_backend == .stage2_x86 or
2423 builtin.zig_backend == .stage2_aarch64 or
......@@ -43,8 +42,6 @@ comptime {
4342 if (!@hasDecl(root, "wWinMainCRTStartup") and !@hasDecl(root, "mainCRTStartup")) {
4443 @export(wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" });
4544 }
46 } else if (builtin.os.tag == .wasi and @hasDecl(root, "main")) {
47 @export(wasiMain2, .{ .name = "_start" });
4845 } else if (builtin.os.tag == .opencl) {
4946 if (@hasDecl(root, "main"))
5047 @export(spirvMain2, .{ .name = "main" });
......@@ -116,22 +113,6 @@ fn callMain2() noreturn {
116113 exit2(0);
117114}
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
135116fn spirvMain2() callconv(.Kernel) void {
136117 root.main();
137118}