Skip to content

Commit a63f787

Browse files
committed
compiler: Fix build break due to #23836 being merged before #23913.
1 parent 999777e commit a63f787

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

src/libs/netbsd.zig

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile {
3434

3535
fn includePath(comp: *Compilation, arena: Allocator, sub_path: []const u8) ![]const u8 {
3636
return path.join(arena, &.{
37-
comp.zig_lib_directory.path.?,
37+
comp.dirs.zig_lib.path.?,
3838
"libc" ++ path.sep_str ++ "include",
3939
sub_path,
4040
});
4141
}
4242

4343
fn csuPath(comp: *Compilation, arena: Allocator, sub_path: []const u8) ![]const u8 {
4444
return path.join(arena, &.{
45-
comp.zig_lib_directory.path.?,
45+
comp.dirs.zig_lib.path.?,
4646
"libc" ++ path.sep_str ++ "netbsd" ++ path.sep_str ++ "lib" ++ path.sep_str ++ "csu",
4747
sub_path,
4848
});
@@ -383,11 +383,11 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
383383
// Use the global cache directory.
384384
var cache: Cache = .{
385385
.gpa = gpa,
386-
.manifest_dir = try comp.global_cache_directory.handle.makeOpenPath("h", .{}),
386+
.manifest_dir = try comp.dirs.global_cache.handle.makeOpenPath("h", .{}),
387387
};
388388
cache.addPrefix(.{ .path = null, .handle = fs.cwd() });
389-
cache.addPrefix(comp.zig_lib_directory);
390-
cache.addPrefix(comp.global_cache_directory);
389+
cache.addPrefix(comp.dirs.zig_lib);
390+
cache.addPrefix(comp.dirs.global_cache);
391391
defer cache.manifest_dir.close();
392392

393393
var man = cache.obtain();
@@ -397,7 +397,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
397397
man.hash.add(target.abi);
398398
man.hash.add(target_version);
399399

400-
const full_abilists_path = try comp.zig_lib_directory.join(arena, &.{abilists_path});
400+
const full_abilists_path = try comp.dirs.zig_lib.join(arena, &.{abilists_path});
401401
const abilists_index = try man.addFile(full_abilists_path, abilists_max_size);
402402

403403
if (try man.hit()) {
@@ -406,7 +406,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
406406
return queueSharedObjects(comp, .{
407407
.lock = man.toOwnedLock(),
408408
.dir_path = .{
409-
.root_dir = comp.global_cache_directory,
409+
.root_dir = comp.dirs.global_cache,
410410
.sub_path = try gpa.dupe(u8, "o" ++ fs.path.sep_str ++ digest),
411411
},
412412
});
@@ -415,9 +415,9 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
415415
const digest = man.final();
416416
const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest });
417417

418-
var o_directory: Compilation.Directory = .{
419-
.handle = try comp.global_cache_directory.handle.makeOpenPath(o_sub_path, .{}),
420-
.path = try comp.global_cache_directory.join(arena, &.{o_sub_path}),
418+
var o_directory: Cache.Directory = .{
419+
.handle = try comp.dirs.global_cache.handle.makeOpenPath(o_sub_path, .{}),
420+
.path = try comp.dirs.global_cache.join(arena, &.{o_sub_path}),
421421
};
422422
defer o_directory.handle.close();
423423

@@ -626,7 +626,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
626626
var lib_name_buf: [32]u8 = undefined; // Larger than each of the names "c", "pthread", etc.
627627
const asm_file_basename = std.fmt.bufPrint(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable;
628628
try o_directory.handle.writeFile(.{ .sub_path = asm_file_basename, .data = stubs_asm.items });
629-
try buildSharedLib(comp, arena, comp.global_cache_directory, o_directory, asm_file_basename, lib, prog_node);
629+
try buildSharedLib(comp, arena, o_directory, asm_file_basename, lib, prog_node);
630630
}
631631

632632
man.writeManifest() catch |err| {
@@ -636,7 +636,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
636636
return queueSharedObjects(comp, .{
637637
.lock = man.toOwnedLock(),
638638
.dir_path = .{
639-
.root_dir = comp.global_cache_directory,
639+
.root_dir = comp.dirs.global_cache,
640640
.sub_path = try gpa.dupe(u8, "o" ++ fs.path.sep_str ++ digest),
641641
},
642642
});
@@ -675,8 +675,7 @@ fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void {
675675
fn buildSharedLib(
676676
comp: *Compilation,
677677
arena: Allocator,
678-
zig_cache_directory: Compilation.Directory,
679-
bin_directory: Compilation.Directory,
678+
bin_directory: Cache.Directory,
680679
asm_file_basename: []const u8,
681680
lib: Lib,
682681
prog_node: std.Progress.Node,
@@ -708,9 +707,8 @@ fn buildSharedLib(
708707
});
709708

710709
const root_mod = try Module.create(arena, .{
711-
.global_cache_directory = comp.global_cache_directory,
712710
.paths = .{
713-
.root = .{ .root_dir = comp.zig_lib_directory },
711+
.root = .zig_lib_root,
714712
.root_src_path = "",
715713
},
716714
.fully_qualified_name = "root",
@@ -730,8 +728,6 @@ fn buildSharedLib(
730728
.global = config,
731729
.cc_argv = &.{},
732730
.parent = null,
733-
.builtin_mod = null,
734-
.builtin_modules = null, // there is only one module in this compilation
735731
});
736732

737733
const c_source_files = [1]Compilation.CSourceFile{
@@ -742,9 +738,7 @@ fn buildSharedLib(
742738
};
743739

744740
const sub_compilation = try Compilation.create(comp.gpa, arena, .{
745-
.local_cache_directory = zig_cache_directory,
746-
.global_cache_directory = comp.global_cache_directory,
747-
.zig_lib_directory = comp.zig_lib_directory,
741+
.dirs = comp.dirs.withoutLocalCache(),
748742
.thread_pool = comp.thread_pool,
749743
.self_exe_path = comp.self_exe_path,
750744
.cache_mode = .incremental,

0 commit comments

Comments
 (0)