Commit 6c15c34421

Jacob Young <jacobly0@users.noreply.github.com>
2023-11-08 13:44:48
MachO: support `-fsingle-threaded` mode
1 parent 8f2aa72
Changed files (1)
src
link
MachO
src/link/MachO/uuid.zig
@@ -5,7 +5,7 @@
 /// TODO LLD also hashes the output filename to disambiguate between same builds with different
 /// output files. Should we also do that?
 pub fn calcUuid(comp: *const Compilation, file: fs.File, file_size: u64, out: *[Md5.digest_length]u8) !void {
-    const num_chunks = comp.thread_pool.threads.len * 0x10;
+    const num_chunks = @max(comp.thread_pool.threads.len, 1) * 0x10;
     const chunk_size = @divTrunc(file_size, num_chunks);
     const actual_num_chunks = if (@rem(file_size, num_chunks) > 0) num_chunks + 1 else num_chunks;