Skip to content

Commit

Permalink
self hosted compiler: avoid Dir.realpathAlloc
Browse files Browse the repository at this point in the history
The use of Dir-related realpath functions will put std.os.getFdPath in
the critical path which makes the compiler less portable.
  • Loading branch information
mikdusan committed Nov 30, 2022
1 parent e4c79c6 commit 31af4b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4074,7 +4074,14 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P
args_dir, args_hex_hash[0..],
});
try output_dir.handle.writeFile(args_file, args);
const args_file_path = try output_dir.handle.realpathAlloc(allocator, args_file);

const args_file_path = args_file_path: {
if (output_dir.path) |odp| {
break :args_file_path try fs.path.join(allocator, &[_][]const u8{ odp, args_file });
} else {
break :args_file_path args_file;
}
};

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

0 comments on commit 31af4b7

Please sign in to comment.