aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-04-20 15:20:12 -0700
committerGitHub <noreply@github.com>2023-04-20 15:20:12 -0700
commit304e4082a0a50c2a6dfbba2a1985cf772edb9e73 (patch)
tree959bfcee9176e487dfcd4488ada99364658f9a37 /src/Compilation.zig
parentfac120bc3ad58a10ab80952e42becd0084aec059 (diff)
parentceff2782029672714ac2e04a7b3e25af23eb9a9b (diff)
downloadzig-304e4082a0a50c2a6dfbba2a1985cf772edb9e73.tar.gz
zig-304e4082a0a50c2a6dfbba2a1985cf772edb9e73.zip
Merge pull request #15193 from davidgm94/dwarf-64-bit-format
Expose an option for producing 64-bit DWARF format
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 48a0412b23..a07ac417e3 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -620,6 +620,7 @@ pub const InitOptions = struct {
test_name_prefix: ?[]const u8 = null,
test_runner_path: ?[]const u8 = null,
subsystem: ?std.Target.SubSystem = null,
+ dwarf_format: ?std.dwarf.Format = null,
/// WASI-only. Type of WASI execution model ("command" or "reactor").
wasi_exec_model: ?std.builtin.WasiExecModel = null,
/// (Zig compiler development) Enable dumping linker's state as JSON.
@@ -1111,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);
@@ -1517,6 +1519,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
.disable_lld_caching = options.disable_lld_caching or cache_mode == .whole,
.subsystem = options.subsystem,
.is_test = options.is_test,
+ .dwarf_format = options.dwarf_format,
.wasi_exec_model = wasi_exec_model,
.hash_style = options.hash_style,
.enable_link_snapshots = options.enable_link_snapshots,
@@ -4488,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"),
}
}