From 412a2f966e18aa792089ac1f41482222d7f2434f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 28 Sep 2020 15:42:09 -0700 Subject: 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. --- src/Module.zig | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index 8f87b7a521..4fcf72f4ff 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -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, -- cgit v1.2.3