| author | |
| committer | |
| log | 0ec01e58b429e96d50411f74a0005076c24dda0c |
| tree | 5981b50b570382137f1cf4c1eb2f528cc6962f21 |
| parent | 3b09262c1252de0d9f946630e701be65bc5b2fc7 |
| parent | e03095f167cf0cd8c1424bff0de3c0a7b5f66b18 |
| signature |
Make stage2 start.zig work on Windows6 files changed, 18 insertions(+), 13 deletions(-)
build.zig+2| ... | ... | @@ -115,6 +115,7 @@ pub fn build(b: *Builder) !void { |
| 115 | 115 | if (target.isWindows() and target.getAbi() == .gnu) { |
| 116 | 116 | // LTO is currently broken on mingw, this can be removed when it's fixed. |
| 117 | 117 | exe.want_lto = false; |
| 118 | test_stage2.want_lto = false; | |
| 118 | 119 | } |
| 119 | 120 | |
| 120 | 121 | const exe_options = b.addOptions(); |
| ... | ... | @@ -501,6 +502,7 @@ fn addStaticLlvmOptionsToExe( |
| 501 | 502 | if (exe.target.getOs().tag == .windows) { |
| 502 | 503 | exe.linkSystemLibrary("version"); |
| 503 | 504 | exe.linkSystemLibrary("uuid"); |
| 505 | exe.linkSystemLibrary("ole32"); | |
| 504 | 506 | } |
| 505 | 507 | } |
| 506 | 508 |
lib/std/start.zig+12| ... | ... | @@ -28,6 +28,8 @@ comptime { |
| 28 | 28 | if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) { |
| 29 | 29 | @export(main2, .{ .name = "main" }); |
| 30 | 30 | } |
| 31 | } else if (builtin.os.tag == .windows) { | |
| 32 | @export(wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" }); | |
| 31 | 33 | } else { |
| 32 | 34 | if (!@hasDecl(root, "_start")) { |
| 33 | 35 | @export(_start2, .{ .name = "_start" }); |
| ... | ... | @@ -96,6 +98,11 @@ fn callMain2() noreturn { |
| 96 | 98 | exit2(0); |
| 97 | 99 | } |
| 98 | 100 | |
| 101 | fn wWinMainCRTStartup2() callconv(.C) noreturn { | |
| 102 | root.main(); | |
| 103 | exit2(0); | |
| 104 | } | |
| 105 | ||
| 99 | 106 | fn exit2(code: usize) noreturn { |
| 100 | 107 | switch (native_os) { |
| 101 | 108 | .linux => switch (builtin.stage2_arch) { |
| ... | ... | @@ -148,11 +155,16 @@ fn exit2(code: usize) noreturn { |
| 148 | 155 | }, |
| 149 | 156 | else => @compileError("TODO"), |
| 150 | 157 | }, |
| 158 | .windows => { | |
| 159 | ExitProcess(@truncate(u32, code)); | |
| 160 | }, | |
| 151 | 161 | else => @compileError("TODO"), |
| 152 | 162 | } |
| 153 | 163 | unreachable; |
| 154 | 164 | } |
| 155 | 165 | |
| 166 | extern "kernel32" fn ExitProcess(exit_code: u32) callconv(.C) noreturn; | |
| 167 | ||
| 156 | 168 | //////////////////////////////////////////////////////////////////////////////// |
| 157 | 169 | |
| 158 | 170 | fn _DllMainCRTStartup( |
src/Module.zig-7| ... | ... | @@ -3758,13 +3758,6 @@ pub fn clearDecl( |
| 3758 | 3758 | dep.removeDependency(decl); |
| 3759 | 3759 | if (outdated_decls) |map| { |
| 3760 | 3760 | map.putAssumeCapacity(dep, {}); |
| 3761 | } else if (std.debug.runtime_safety) { | |
| 3762 | // If `outdated_decls` is `null`, it means we're being called from | |
| 3763 | // `Compilation` after `performAllTheWork` and we cannot queue up any | |
| 3764 | // more work. `dep` must necessarily be another Decl that is no longer | |
| 3765 | // being referenced, and will be in the `deletion_set`. Otherwise, | |
| 3766 | // something has gone wrong. | |
| 3767 | assert(mod.deletion_set.contains(dep)); | |
| 3768 | 3761 | } |
| 3769 | 3762 | } |
| 3770 | 3763 | decl.dependants.clearRetainingCapacity(); |
src/type.zig+2-4| ... | ... | @@ -1336,6 +1336,8 @@ pub const Type = extern union { |
| 1336 | 1336 | } |
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | /// For structs and unions, if the type does not have their fields resolved | |
| 1340 | /// this will return `false`. | |
| 1339 | 1341 | pub fn hasCodeGenBits(self: Type) bool { |
| 1340 | 1342 | return switch (self.tag()) { |
| 1341 | 1343 | .u1, |
| ... | ... | @@ -1400,14 +1402,10 @@ pub const Type = extern union { |
| 1400 | 1402 | => true, |
| 1401 | 1403 | |
| 1402 | 1404 | .@"struct" => { |
| 1403 | // TODO introduce lazy value mechanism | |
| 1404 | 1405 | const struct_obj = self.castTag(.@"struct").?.data; |
| 1405 | 1406 | if (struct_obj.known_has_bits) { |
| 1406 | 1407 | return true; |
| 1407 | 1408 | } |
| 1408 | assert(struct_obj.status == .have_field_types or | |
| 1409 | struct_obj.status == .layout_wip or | |
| 1410 | struct_obj.status == .have_layout); | |
| 1411 | 1409 | for (struct_obj.fields.values()) |value| { |
| 1412 | 1410 | if (value.ty.hasCodeGenBits()) |
| 1413 | 1411 | return true; |
test/cases.zig+1-1| ... | ... | @@ -26,7 +26,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 26 | 26 | var case = ctx.exe("hello world with updates", linux_x64); |
| 27 | 27 | |
| 28 | 28 | case.addError("", &[_][]const u8{ |
| 29 | ":95:9: error: struct 'tmp.tmp' has no member named 'main'", | |
| 29 | ":97:9: error: struct 'tmp.tmp' has no member named 'main'", | |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | 32 | // Incorrect return type |
test/stage2/darwin.zig+1-1| ... | ... | @@ -14,7 +14,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 14 | 14 | { |
| 15 | 15 | var case = ctx.exe("darwin hello world with updates", target); |
| 16 | 16 | case.addError("", &[_][]const u8{ |
| 17 | ":95:9: error: struct 'tmp.tmp' has no member named 'main'", | |
| 17 | ":97:9: error: struct 'tmp.tmp' has no member named 'main'", | |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | // Incorrect return type |