authorgravatar for jcmoyer32@gmail.comJ.C. Moyer <jcmoyer32@gmail.com> 2022-10-07 06:39:50-04:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-11-10 13:43:35+01:00
logdd8df1caf33291c2deddf684354c3dd80c402b45
tree64d65959b8e728421c631e51bd5703719a919093
parent2d5fbbb44e15b07531251ee406a0df73321e8175

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.

1 files changed, 7 insertions(+), 0 deletions(-)

src/link/Coff/lld.zig+7
...@@ -181,6 +181,13 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod...@@ -181,6 +181,13 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
181 try argv.append("-NOLOGO");181 try argv.append("-NOLOGO");
182 if (!self.base.options.strip) {182 if (!self.base.options.strip) {
183 try argv.append("-DEBUG");183 try argv.append("-DEBUG");
184
185 const out_ext = std.fs.path.extension(full_out_path);
186 const out_pdb = try allocPrint(arena, "{s}.pdb", .{
187 full_out_path[0 .. full_out_path.len - out_ext.len],
188 });
189 try argv.append(try allocPrint(arena, "-PDB:{s}", .{out_pdb}));
190 try argv.append(try allocPrint(arena, "-PDBALTPATH:{s}", .{out_pdb}));
184 }191 }
185 if (self.base.options.lto) {192 if (self.base.options.lto) {
186 switch (self.base.options.optimize_mode) {193 switch (self.base.options.optimize_mode) {