diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-09-28 15:42:09 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-09-28 15:42:09 -0700 |
| commit | 412a2f966e18aa792089ac1f41482222d7f2434f (patch) | |
| tree | 36f4d7f00ce93bc3f10844e3bbf56f75c8ddba8d /src/link/Coff.zig | |
| parent | 91a73a177bc20fa0219dbb6c3cf3dda1c2a465db (diff) | |
| download | zig-412a2f966e18aa792089ac1f41482222d7f2434f.tar.gz zig-412a2f966e18aa792089ac1f41482222d7f2434f.zip | |
store stage1 flags in a trailing byte in the hash id symlink
When we get a cache hit for a stage1 compilation, we need to know about
some of the flags such as have_winmain or have_dllmain to know which
subsystem to infer during linking.
To do this, we append a hex-encoded byte into the intentionally-dangling
symlink which contains the cache hash digest rather than a filename. The
hex-encoded byte contains the flags we need to infer the subsystem
during linking.
Diffstat (limited to 'src/link/Coff.zig')
| -rw-r--r-- | src/link/Coff.zig | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/link/Coff.zig b/src/link/Coff.zig index e1d7a07fbc..0356a327ba 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -943,14 +943,15 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { switch (target.os.tag) { .windows => { if (self.base.options.module) |module| { - if (module.have_dllmain_crt_startup or is_dyn_lib) + if (module.stage1_flags.have_dllmain_crt_startup or is_dyn_lib) break :blk null; - if (module.have_c_main or self.base.options.is_test or - module.have_winmain_crt_startup or module.have_wwinmain_crt_startup) + if (module.stage1_flags.have_c_main or self.base.options.is_test or + module.stage1_flags.have_winmain_crt_startup or + module.stage1_flags.have_wwinmain_crt_startup) { break :blk .Console; } - if (module.have_winmain or module.have_wwinmain) + if (module.stage1_flags.have_winmain or module.stage1_flags.have_wwinmain) break :blk .Windows; } }, @@ -1068,11 +1069,11 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { try argv.append("-NODEFAULTLIB"); if (!is_lib) { if (self.base.options.module) |module| { - if (module.have_winmain) { + if (module.stage1_flags.have_winmain) { try argv.append("-ENTRY:WinMain"); - } else if (module.have_wwinmain) { + } else if (module.stage1_flags.have_wwinmain) { try argv.append("-ENTRY:wWinMain"); - } else if (module.have_wwinmain_crt_startup) { + } else if (module.stage1_flags.have_wwinmain_crt_startup) { try argv.append("-ENTRY:wWinMainCRTStartup"); } else { try argv.append("-ENTRY:WinMainCRTStartup"); |
