Skip to content

Commit a32b324

Browse files
committed
libs: fix caching behavior
glibc, freebsd, and netbsd all do caching manually, because of the fact that they emit multiple files which they want to cache as a block. Therefore, the individual sub-compilation on a cache miss should be using `CacheMode.none` so that we can specify the output paths for each sub-compilation as being in the shared output directory.
1 parent 7c4ca45 commit a32b324

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/libs/freebsd.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,12 +1073,14 @@ fn buildSharedLib(
10731073
.dirs = comp.dirs.withoutLocalCache(),
10741074
.thread_pool = comp.thread_pool,
10751075
.self_exe_path = comp.self_exe_path,
1076-
.cache_mode = .incremental,
1076+
// Because we manually cache the whole set of objects, we don't cache the individual objects
1077+
// within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path.
1078+
.cache_mode = .none,
10771079
.config = config,
10781080
.root_mod = root_mod,
10791081
.root_name = lib.name,
10801082
.libc_installation = comp.libc_installation,
1081-
.emit_bin = .yes_cache,
1083+
.emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
10821084
.verbose_cc = comp.verbose_cc,
10831085
.verbose_link = comp.verbose_link,
10841086
.verbose_air = comp.verbose_air,

src/libs/glibc.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,12 +1239,14 @@ fn buildSharedLib(
12391239
.dirs = comp.dirs.withoutLocalCache(),
12401240
.thread_pool = comp.thread_pool,
12411241
.self_exe_path = comp.self_exe_path,
1242-
.cache_mode = .incremental,
1242+
// Because we manually cache the whole set of objects, we don't cache the individual objects
1243+
// within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path.
1244+
.cache_mode = .none,
12431245
.config = config,
12441246
.root_mod = root_mod,
12451247
.root_name = lib.name,
12461248
.libc_installation = comp.libc_installation,
1247-
.emit_bin = .yes_cache,
1249+
.emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
12481250
.verbose_cc = comp.verbose_cc,
12491251
.verbose_link = comp.verbose_link,
12501252
.verbose_air = comp.verbose_air,

src/libs/netbsd.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,12 +737,14 @@ fn buildSharedLib(
737737
.dirs = comp.dirs.withoutLocalCache(),
738738
.thread_pool = comp.thread_pool,
739739
.self_exe_path = comp.self_exe_path,
740-
.cache_mode = .incremental,
740+
// Because we manually cache the whole set of objects, we don't cache the individual objects
741+
// within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path.
742+
.cache_mode = .none,
741743
.config = config,
742744
.root_mod = root_mod,
743745
.root_name = lib.name,
744746
.libc_installation = comp.libc_installation,
745-
.emit_bin = .yes_cache,
747+
.emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) },
746748
.verbose_cc = comp.verbose_cc,
747749
.verbose_link = comp.verbose_link,
748750
.verbose_air = comp.verbose_air,

0 commit comments

Comments
 (0)