| ... | @@ -24,7 +24,9 @@ pub const simplified_logic = | ... | @@ -24,7 +24,9 @@ pub const simplified_logic = |
| 24 | builtin.zig_backend == .stage2_aarch64 or | 24 | builtin.zig_backend == .stage2_aarch64 or |
| 25 | builtin.zig_backend == .stage2_arm or | 25 | builtin.zig_backend == .stage2_arm or |
| 26 | builtin.zig_backend == .stage2_riscv64 or | 26 | builtin.zig_backend == .stage2_riscv64 or |
| 27 | builtin.zig_backend == .stage2_sparc64; | 27 | builtin.zig_backend == .stage2_sparc64 or |
| | 28 | builtin.cpu.arch == .spirv32 or |
| | 29 | builtin.cpu.arch == .spirv64; |
| 28 | | 30 | |
| 29 | comptime { | 31 | comptime { |
| 30 | // No matter what, we import the root file, so that any export, test, comptime | 32 | // No matter what, we import the root file, so that any export, test, comptime |
| ... | @@ -43,6 +45,9 @@ comptime { | ... | @@ -43,6 +45,9 @@ comptime { |
| 43 | } | 45 | } |
| 44 | } else if (builtin.os.tag == .wasi and @hasDecl(root, "main")) { | 46 | } else if (builtin.os.tag == .wasi and @hasDecl(root, "main")) { |
| 45 | @export(wasiMain2, .{ .name = "_start" }); | 47 | @export(wasiMain2, .{ .name = "_start" }); |
| | 48 | } else if (builtin.os.tag == .opencl) { |
| | 49 | if (@hasDecl(root, "main")) |
| | 50 | @export(spirvMain2, .{ .name = "main" }); |
| 46 | } else { | 51 | } else { |
| 47 | if (!@hasDecl(root, "_start")) { | 52 | if (!@hasDecl(root, "_start")) { |
| 48 | @export(_start2, .{ .name = "_start" }); | 53 | @export(_start2, .{ .name = "_start" }); |
| ... | @@ -127,6 +132,10 @@ fn wasiMain2() callconv(.C) noreturn { | ... | @@ -127,6 +132,10 @@ fn wasiMain2() callconv(.C) noreturn { |
| 127 | } | 132 | } |
| 128 | } | 133 | } |
| 129 | | 134 | |
| | 135 | fn spirvMain2() callconv(.Kernel) void { |
| | 136 | root.main(); |
| | 137 | } |
| | 138 | |
| 130 | fn wWinMainCRTStartup2() callconv(.C) noreturn { | 139 | fn wWinMainCRTStartup2() callconv(.C) noreturn { |
| 131 | root.main(); | 140 | root.main(); |
| 132 | exit2(0); | 141 | exit2(0); |