diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-06-08 22:57:37 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-06-12 17:51:29 +0100 |
| commit | e28b699cbfa4390366d68784b896ee2662af411d (patch) | |
| tree | e5e8726d7ddf595856e809dbfe2d67496e088100 /src/libs | |
| parent | ac745edbbd6687c5898bb3a50bf9d31d86e57b9e (diff) | |
| download | zig-e28b699cbfa4390366d68784b896ee2662af411d.tar.gz zig-e28b699cbfa4390366d68784b896ee2662af411d.zip | |
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.
Diffstat (limited to 'src/libs')
| -rw-r--r-- | src/libs/freebsd.zig | 6 | ||||
| -rw-r--r-- | src/libs/glibc.zig | 6 | ||||
| -rw-r--r-- | src/libs/netbsd.zig | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/libs/freebsd.zig b/src/libs/freebsd.zig index 0d14b6fb47..f6195ffa91 100644 --- a/src/libs/freebsd.zig +++ b/src/libs/freebsd.zig @@ -1073,12 +1073,14 @@ fn buildSharedLib( .dirs = comp.dirs.withoutLocalCache(), .thread_pool = comp.thread_pool, .self_exe_path = comp.self_exe_path, - .cache_mode = .incremental, + // Because we manually cache the whole set of objects, we don't cache the individual objects + // within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path. + .cache_mode = .none, .config = config, .root_mod = root_mod, .root_name = lib.name, .libc_installation = comp.libc_installation, - .emit_bin = .yes_cache, + .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) }, .verbose_cc = comp.verbose_cc, .verbose_link = comp.verbose_link, .verbose_air = comp.verbose_air, diff --git a/src/libs/glibc.zig b/src/libs/glibc.zig index cb8dd4b460..8031827a9d 100644 --- a/src/libs/glibc.zig +++ b/src/libs/glibc.zig @@ -1239,12 +1239,14 @@ fn buildSharedLib( .dirs = comp.dirs.withoutLocalCache(), .thread_pool = comp.thread_pool, .self_exe_path = comp.self_exe_path, - .cache_mode = .incremental, + // Because we manually cache the whole set of objects, we don't cache the individual objects + // within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path. + .cache_mode = .none, .config = config, .root_mod = root_mod, .root_name = lib.name, .libc_installation = comp.libc_installation, - .emit_bin = .yes_cache, + .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) }, .verbose_cc = comp.verbose_cc, .verbose_link = comp.verbose_link, .verbose_air = comp.verbose_air, diff --git a/src/libs/netbsd.zig b/src/libs/netbsd.zig index f19c528d5d..fdab27f217 100644 --- a/src/libs/netbsd.zig +++ b/src/libs/netbsd.zig @@ -737,12 +737,14 @@ fn buildSharedLib( .dirs = comp.dirs.withoutLocalCache(), .thread_pool = comp.thread_pool, .self_exe_path = comp.self_exe_path, - .cache_mode = .incremental, + // Because we manually cache the whole set of objects, we don't cache the individual objects + // within it. In fact, we *can't* do that, because we need `emit_bin` to specify the path. + .cache_mode = .none, .config = config, .root_mod = root_mod, .root_name = lib.name, .libc_installation = comp.libc_installation, - .emit_bin = .yes_cache, + .emit_bin = .{ .yes_path = try bin_directory.join(arena, &.{basename}) }, .verbose_cc = comp.verbose_cc, .verbose_link = comp.verbose_link, .verbose_air = comp.verbose_air, |
