aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-04-20 15:09:33 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-04-20 15:17:07 -0700
commitceff2782029672714ac2e04a7b3e25af23eb9a9b (patch)
tree959bfcee9176e487dfcd4488ada99364658f9a37 /src/Compilation.zig
parentd026202a26e56e7e2ea20ca49509fdcf8b937020 (diff)
downloadzig-ceff2782029672714ac2e04a7b3e25af23eb9a9b.tar.gz
zig-ceff2782029672714ac2e04a7b3e25af23eb9a9b.zip
fixes to the previous commit
* CompileStep: Avoid calling producesPdbFile() to determine whether the option should be respected. If the user asks for it, put it on the command line and let the Zig CLI deal with it appropriately. * Make the namespace of `std.dwarf.Format.dwarf32` no longer have a redundant "dwarf" in it. * Add `zig cc` integration for `-gdwarf32` and `-gdwarf64`. * Toss in a bonus bug fix for `-gdwarf-2`, `-gdwarf-3`, etc. * Avoid using default init values for struct fields unnecessarily. * Add missing cache hash addition for the new option.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 848b1594fa..a07ac417e3 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1112,6 +1112,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
cache.hash.add(link_libunwind);
cache.hash.add(options.output_mode);
cache.hash.add(options.machine_code_model);
+ cache.hash.addOptional(options.dwarf_format);
cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_bin);
cache_helpers.addOptionalEmitLoc(&cache.hash, options.emit_implib);
cache.hash.addBytes(options.root_name);
@@ -4490,7 +4491,13 @@ pub fn addCCArgs(
// generation, it only changes the type of information generated.
try argv.appendSlice(&.{ "-g", "-gcodeview" });
},
- .elf, .macho => try argv.append("-gdwarf-4"),
+ .elf, .macho => {
+ try argv.append("-gdwarf-4");
+ if (comp.bin_file.options.dwarf_format) |f| switch (f) {
+ .@"32" => try argv.append("-gdwarf32"),
+ .@"64" => try argv.append("-gdwarf64"),
+ };
+ },
else => try argv.append("-g"),
}
}