[PATCH] D90507: Adding DWARF64 clang flag: -gdwarf64

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 16:49:35 PST 2020


ayermolo added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:2145-2146
   HelpText<"Generate source-level debug information with dwarf version 5">;
+def gdwarf64 : Flag<["-"], "gdwarf64">, Group<g_Group>, Flags<[CC1Option]>,
+  HelpText<"Generate DWARF64 debug information.">;
 
----------------
ayermolo wrote:
> dblaikie wrote:
> > Does this actually enable debug info emission (the -gdwarf-N versions do cause debug info to be emitted, and set the dwarf version - but, say -ggnu-pubnames does not cause debug info to be emitted if it isn't otherwise requested). Experience has shown it's probably better to have flags like this not enable debug info emission - so they can be used orthogonally (eg: if a project is large, it can add -gdwarf64 to its flags permanently, even though maybe only some build modes, etc, enable debug info (with -g))
> > 
> > If this doesn't enable debug info emission, the phrasing of the help text might be worth changing somewhat (I wonder how we document -ggnu-pubnames, for instance/comparison/inspiration)
> This enables DWARF64 if emission is enabled.
> 
> From DebugInfo it seems like it's only Elf Format:
> 
> bool Dwarf64 = Asm->TM.Options.MCOptions.Dwarf64 &&
>                  DwarfVersion >= 3 &&   // DWARF64 was introduced in DWARFv3.
>                  TT.isArch64Bit() &&    // DWARF64 requires 64-bit relocations.
>                  TT.isOSBinFormatELF(); // Support only ELF for now.
> This enables DWARF64 if emission is enabled.
> 





================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4025
+          << A->getAsString(Args) << "64 bit architecutre";
+    else
+      CmdArgs.push_back("-gdwarf64");
----------------
dblaikie wrote:
> ikudrin wrote:
> > We also should check that the output format is ELF.
> Is DWARF64 not supported on MachO, for instance? (I'd have DWARF64 would be pretty usable on any platform that supported DWARF in general - certainly some system tools that are DWARF aware (including actual debuggers) might not be up to the task of using it - but if we can correctly generate it in the object files, it seems OK to accept the request (useful for folks testing out/implementing DWARF64 consumers on those platforms))
 From DebugInfo it seems like it's only Elf Format:
 

```
 bool Dwarf64 = Asm->TM.Options.MCOptions.Dwarf64 &&
                  DwarfVersion >= 3 &&   // DWARF64 was introduced in DWARFv3.
                  TT.isArch64Bit() &&    // DWARF64 requires 64-bit relocations.
                 TT.isOSBinFormatELF(); // Support only ELF for now.
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90507/new/

https://reviews.llvm.org/D90507



More information about the llvm-commits mailing list