aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ.C. Moyer <jcmoyer32@gmail.com>2022-10-07 06:39:50 -0400
committerJakub Konka <kubkon@jakubkonka.com>2022-11-10 13:43:35 +0100
commitdd8df1caf33291c2deddf684354c3dd80c402b45 (patch)
tree64d65959b8e728421c631e51bd5703719a919093 /src
parent2d5fbbb44e15b07531251ee406a0df73321e8175 (diff)
downloadzig-dd8df1caf33291c2deddf684354c3dd80c402b45.tar.gz
zig-dd8df1caf33291c2deddf684354c3dd80c402b45.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/link/Coff/lld.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/link/Coff/lld.zig b/src/link/Coff/lld.zig
index 7047d4fdba..9d9d1e4094 100644
--- a/src/link/Coff/lld.zig
+++ b/src/link/Coff/lld.zig
@@ -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) {