aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-08-23 21:24:03 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-08-23 21:24:03 -0700
commita31b449b55c32eba1cb61a48753a6fc98696c98f (patch)
treed4141e59b51882e94a98ac5c9e023b22af1ddc66 /src/Compilation.zig
parent60722261fa465ecff559c9903e0855d538826ed4 (diff)
downloadzig-a31b449b55c32eba1cb61a48753a6fc98696c98f.tar.gz
zig-a31b449b55c32eba1cb61a48753a6fc98696c98f.zip
make LLVM and Clang emit DWARF 4 instead of 5
This reverts 6d679eb2bcbe76e389c02e0bb4d4c4feb2847783 and additionally changes the command line parameters passed to Clang to match. Clang 14 defaults to DWARFv5 which is an interesting choice. v5 has been out for 5 years and yet Valgrind does not support it, and apparently neither does either GDB or LLD, I haven't determined which, but I wasn't able to use GDB to debug my LLVM-emitted dwarf 5 zig code that was linked with LLD. A couple years ago when I was working on the self-hosted ELF linker, I emitted DWARFv5 but then downgraded to v4 when I realized that third party tools were stuck in the past. Years later, they still are. Hopefully, Clang 14's bold move will inspire third party tools to get their shit together, however, in the meantime, everything's broken, so we're passing `-gdwarf-4` to clang and instructing LLVM to emit DWARFv4. Note that Zig's std.debug code *does* support DWARFv5 already as of a previous commit that I made today.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 0914685c77..1bc9719e1b 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -4085,10 +4085,10 @@ pub fn addCCArgs(
}
if (!comp.bin_file.options.strip) {
- try argv.append("-g");
switch (target.ofmt) {
.coff => try argv.append("-gcodeview"),
- else => {},
+ .elf, .macho => try argv.append("-gdwarf-4"),
+ else => try argv.append("-g"),
}
}