authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-20 07:59:16+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-20 13:22:11+02:00
loga63f7875f451bda975ddabcc0c1feed10a216516
treef23fca9f5034e223c2b4be0911fe14258fa7ce06
parent999777e73aa1bd06b05cbe53f8c2488877e18874

compiler: Fix build break due to #23836 being merged before #23913.


1 files changed, 15 insertions(+), 21 deletions(-)

src/libs/netbsd.zig+15-21
...@@ -34,7 +34,7 @@ pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile {...@@ -34,7 +34,7 @@ pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile {
3434
35fn includePath(comp: *Compilation, arena: Allocator, sub_path: []const u8) ![]const u8 {35fn includePath(comp: *Compilation, arena: Allocator, sub_path: []const u8) ![]const u8 {
36 return path.join(arena, &.{36 return path.join(arena, &.{
37 comp.zig_lib_directory.path.?,37 comp.dirs.zig_lib.path.?,
38 "libc" ++ path.sep_str ++ "include",38 "libc" ++ path.sep_str ++ "include",
39 sub_path,39 sub_path,
40 });40 });
...@@ -42,7 +42,7 @@ fn includePath(comp: *Compilation, arena: Allocator, sub_path: []const u8) ![]co...@@ -42,7 +42,7 @@ fn includePath(comp: *Compilation, arena: Allocator, sub_path: []const u8) ![]co
4242
43fn csuPath(comp: *Compilation, arena: Allocator, sub_path: []const u8) ![]const u8 {43fn csuPath(comp: *Compilation, arena: Allocator, sub_path: []const u8) ![]const u8 {
44 return path.join(arena, &.{44 return path.join(arena, &.{
45 comp.zig_lib_directory.path.?,45 comp.dirs.zig_lib.path.?,
46 "libc" ++ path.sep_str ++ "netbsd" ++ path.sep_str ++ "lib" ++ path.sep_str ++ "csu",46 "libc" ++ path.sep_str ++ "netbsd" ++ path.sep_str ++ "lib" ++ path.sep_str ++ "csu",
47 sub_path,47 sub_path,
48 });48 });
...@@ -383,11 +383,11 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye...@@ -383,11 +383,11 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
383 // Use the global cache directory.383 // Use the global cache directory.
384 var cache: Cache = .{384 var cache: Cache = .{
385 .gpa = gpa,385 .gpa = gpa,
386 .manifest_dir = try comp.global_cache_directory.handle.makeOpenPath("h", .{}),386 .manifest_dir = try comp.dirs.global_cache.handle.makeOpenPath("h", .{}),
387 };387 };
388 cache.addPrefix(.{ .path = null, .handle = fs.cwd() });388 cache.addPrefix(.{ .path = null, .handle = fs.cwd() });
389 cache.addPrefix(comp.zig_lib_directory);389 cache.addPrefix(comp.dirs.zig_lib);
390 cache.addPrefix(comp.global_cache_directory);390 cache.addPrefix(comp.dirs.global_cache);
391 defer cache.manifest_dir.close();391 defer cache.manifest_dir.close();
392392
393 var man = cache.obtain();393 var man = cache.obtain();
...@@ -397,7 +397,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye...@@ -397,7 +397,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
397 man.hash.add(target.abi);397 man.hash.add(target.abi);
398 man.hash.add(target_version);398 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});
401 const abilists_index = try man.addFile(full_abilists_path, abilists_max_size);401 const abilists_index = try man.addFile(full_abilists_path, abilists_max_size);
402402
403 if (try man.hit()) {403 if (try man.hit()) {
...@@ -406,7 +406,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye...@@ -406,7 +406,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
406 return queueSharedObjects(comp, .{406 return queueSharedObjects(comp, .{
407 .lock = man.toOwnedLock(),407 .lock = man.toOwnedLock(),
408 .dir_path = .{408 .dir_path = .{
409 .root_dir = comp.global_cache_directory,409 .root_dir = comp.dirs.global_cache,
410 .sub_path = try gpa.dupe(u8, "o" ++ fs.path.sep_str ++ digest),410 .sub_path = try gpa.dupe(u8, "o" ++ fs.path.sep_str ++ digest),
411 },411 },
412 });412 });
...@@ -415,9 +415,9 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye...@@ -415,9 +415,9 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
415 const digest = man.final();415 const digest = man.final();
416 const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest });416 const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest });
417417
418 var o_directory: Compilation.Directory = .{418 var o_directory: Cache.Directory = .{
419 .handle = try comp.global_cache_directory.handle.makeOpenPath(o_sub_path, .{}),419 .handle = try comp.dirs.global_cache.handle.makeOpenPath(o_sub_path, .{}),
420 .path = try comp.global_cache_directory.join(arena, &.{o_sub_path}),420 .path = try comp.dirs.global_cache.join(arena, &.{o_sub_path}),
421 };421 };
422 defer o_directory.handle.close();422 defer o_directory.handle.close();
423423
...@@ -626,7 +626,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye...@@ -626,7 +626,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
626 var lib_name_buf: [32]u8 = undefined; // Larger than each of the names "c", "pthread", etc.626 var lib_name_buf: [32]u8 = undefined; // Larger than each of the names "c", "pthread", etc.
627 const asm_file_basename = std.fmt.bufPrint(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable;627 const asm_file_basename = std.fmt.bufPrint(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable;
628 try o_directory.handle.writeFile(.{ .sub_path = asm_file_basename, .data = stubs_asm.items });628 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);
630 }630 }
631631
632 man.writeManifest() catch |err| {632 man.writeManifest() catch |err| {
...@@ -636,7 +636,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye...@@ -636,7 +636,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
636 return queueSharedObjects(comp, .{636 return queueSharedObjects(comp, .{
637 .lock = man.toOwnedLock(),637 .lock = man.toOwnedLock(),
638 .dir_path = .{638 .dir_path = .{
639 .root_dir = comp.global_cache_directory,639 .root_dir = comp.dirs.global_cache,
640 .sub_path = try gpa.dupe(u8, "o" ++ fs.path.sep_str ++ digest),640 .sub_path = try gpa.dupe(u8, "o" ++ fs.path.sep_str ++ digest),
641 },641 },
642 });642 });
...@@ -675,8 +675,7 @@ fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void {...@@ -675,8 +675,7 @@ fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void {
675fn buildSharedLib(675fn buildSharedLib(
676 comp: *Compilation,676 comp: *Compilation,
677 arena: Allocator,677 arena: Allocator,
678 zig_cache_directory: Compilation.Directory,678 bin_directory: Cache.Directory,
679 bin_directory: Compilation.Directory,
680 asm_file_basename: []const u8,679 asm_file_basename: []const u8,
681 lib: Lib,680 lib: Lib,
682 prog_node: std.Progress.Node,681 prog_node: std.Progress.Node,
...@@ -708,9 +707,8 @@ fn buildSharedLib(...@@ -708,9 +707,8 @@ fn buildSharedLib(
708 });707 });
709708
710 const root_mod = try Module.create(arena, .{709 const root_mod = try Module.create(arena, .{
711 .global_cache_directory = comp.global_cache_directory,
712 .paths = .{710 .paths = .{
713 .root = .{ .root_dir = comp.zig_lib_directory },711 .root = .zig_lib_root,
714 .root_src_path = "",712 .root_src_path = "",
715 },713 },
716 .fully_qualified_name = "root",714 .fully_qualified_name = "root",
...@@ -730,8 +728,6 @@ fn buildSharedLib(...@@ -730,8 +728,6 @@ fn buildSharedLib(
730 .global = config,728 .global = config,
731 .cc_argv = &.{},729 .cc_argv = &.{},
732 .parent = null,730 .parent = null,
733 .builtin_mod = null,
734 .builtin_modules = null, // there is only one module in this compilation
735 });731 });
736732
737 const c_source_files = [1]Compilation.CSourceFile{733 const c_source_files = [1]Compilation.CSourceFile{
...@@ -742,9 +738,7 @@ fn buildSharedLib(...@@ -742,9 +738,7 @@ fn buildSharedLib(
742 };738 };
743739
744 const sub_compilation = try Compilation.create(comp.gpa, arena, .{740 const sub_compilation = try Compilation.create(comp.gpa, arena, .{
745 .local_cache_directory = zig_cache_directory,741 .dirs = comp.dirs.withoutLocalCache(),
746 .global_cache_directory = comp.global_cache_directory,
747 .zig_lib_directory = comp.zig_lib_directory,
748 .thread_pool = comp.thread_pool,742 .thread_pool = comp.thread_pool,
749 .self_exe_path = comp.self_exe_path,743 .self_exe_path = comp.self_exe_path,
750 .cache_mode = .incremental,744 .cache_mode = .incremental,