Windows: Explicitly pass PDB paths to lld-link

On Windows, lld-link resolves PDB output paths using `/` and embeds the
result in the final executable, which breaks some native tooling like
WPR/WPA. This commit overrides the default behavior of lld-link by
explicitly setting the output PDB filename and binary-embedded path.
This commit is contained in:
J.C. Moyer 2022-10-07 06:39:50 -04:00 committed by Jakub Konka
parent 2d5fbbb44e
commit dd8df1caf3

View File

@ -181,6 +181,13 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
try argv.append("-NOLOGO");
if (!self.base.options.strip) {
try argv.append("-DEBUG");
const out_ext = std.fs.path.extension(full_out_path);
const out_pdb = try allocPrint(arena, "{s}.pdb", .{
full_out_path[0 .. full_out_path.len - out_ext.len],
});
try argv.append(try allocPrint(arena, "-PDB:{s}", .{out_pdb}));
try argv.append(try allocPrint(arena, "-PDBALTPATH:{s}", .{out_pdb}));
}
if (self.base.options.lto) {
switch (self.base.options.optimize_mode) {