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.
This commit is contained in:
Andrew Kelley
2020-09-28 15:42:09 -07:00
parent 91a73a177b
commit 412a2f966e
4 changed files with 56 additions and 27 deletions

View File

@@ -75,12 +75,15 @@ global_error_set: std.StringHashMapUnmanaged(u16) = .{},
/// previous analysis.
generation: u32 = 0,
have_winmain: bool = false,
have_wwinmain: bool = false,
have_winmain_crt_startup: bool = false,
have_wwinmain_crt_startup: bool = false,
have_dllmain_crt_startup: bool = false,
have_c_main: bool = false,
stage1_flags: packed struct {
have_winmain: bool = false,
have_wwinmain: bool = false,
have_winmain_crt_startup: bool = false,
have_wwinmain_crt_startup: bool = false,
have_dllmain_crt_startup: bool = false,
have_c_main: bool = false,
reserved: u2 = 0,
} = .{},
pub const Export = struct {
options: std.builtin.ExportOptions,