Skip to content

Commit 31af4b7

Browse files
committed
self hosted compiler: avoid Dir.realpathAlloc
The use of Dir-related realpath functions will put std.os.getFdPath in the critical path which makes the compiler less portable.
1 parent e4c79c6 commit 31af4b7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Compilation.zig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4074,7 +4074,14 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P
40744074
args_dir, args_hex_hash[0..],
40754075
});
40764076
try output_dir.handle.writeFile(args_file, args);
4077-
const args_file_path = try output_dir.handle.realpathAlloc(allocator, args_file);
4077+
4078+
const args_file_path = args_file_path: {
4079+
if (output_dir.path) |odp| {
4080+
break :args_file_path try fs.path.join(allocator, &[_][]const u8{ odp, args_file });
4081+
} else {
4082+
break :args_file_path args_file;
4083+
}
4084+
};
40784085

40794086
argv.shrinkRetainingCapacity(2);
40804087
try argv.append(try std.mem.concat(allocator, u8, &[_][]const u8{ "@", args_file_path }));

0 commit comments

Comments
 (0)