@@ -174,6 +174,12 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
174174 const target_ver = target .os .version_range .linux .glibc ;
175175 const start_old_init_fini = target_ver .order (.{ .major = 2 , .minor = 33 }) != .gt ;
176176
177+ // In all cases in this function, we add the C compiler flags to
178+ // cache_exempt_flags rather than extra_flags, because these arguments
179+ // depend on only properties that are already covered by the cache
180+ // manifest. Including these arguments in the cache could only possibly
181+ // waste computation and create false negatives.
182+
177183 switch (crt_file ) {
178184 .crti_o = > {
179185 var args = std .ArrayList ([]const u8 ).init (arena );
@@ -193,7 +199,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
193199 return comp .build_crt_file ("crti" , .Obj , &[1 ]Compilation.CSourceFile {
194200 .{
195201 .src_path = try start_asm_path (comp , arena , "crti.S" ),
196- .extra_flags = args .items ,
202+ .cache_exempt_flags = args .items ,
197203 },
198204 });
199205 },
@@ -212,7 +218,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
212218 return comp .build_crt_file ("crtn" , .Obj , &[1 ]Compilation.CSourceFile {
213219 .{
214220 .src_path = try start_asm_path (comp , arena , "crtn.S" ),
215- .extra_flags = args .items ,
221+ .cache_exempt_flags = args .items ,
216222 },
217223 });
218224 },
@@ -237,7 +243,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
237243 const src_path = if (start_old_init_fini ) "start-2.33.S" else "start.S" ;
238244 break :blk .{
239245 .src_path = try start_asm_path (comp , arena , src_path ),
240- .extra_flags = args .items ,
246+ .cache_exempt_flags = args .items ,
241247 };
242248 };
243249 const abi_note_o : Compilation.CSourceFile = blk : {
@@ -256,7 +262,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
256262 });
257263 break :blk .{
258264 .src_path = try lib_path (comp , arena , lib_libc_glibc ++ "csu" ++ path .sep_str ++ "abi-note.S" ),
259- .extra_flags = args .items ,
265+ .cache_exempt_flags = args .items ,
260266 };
261267 };
262268 return comp .build_crt_file ("Scrt1" , .Obj , &[_ ]Compilation.CSourceFile { start_o , abi_note_o });
@@ -355,7 +361,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
355361 });
356362 files_buf [files_index ] = .{
357363 .src_path = try lib_path (comp , arena , dep .path ),
358- .extra_flags = args .items ,
364+ .cache_exempt_flags = args .items ,
359365 };
360366 files_index += 1 ;
361367 }
@@ -661,7 +667,6 @@ pub fn buildSharedObjects(comp: *Compilation) !void {
661667 var man = cache .obtain ();
662668 defer man .deinit ();
663669 man .hash .addBytes (build_options .version );
664- man .hash .addBytes (comp .zig_lib_directory .path orelse "." );
665670 man .hash .add (target .cpu .arch );
666671 man .hash .add (target .abi );
667672 man .hash .add (target_version );
0 commit comments