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

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 16:51:27 PST 2020


dblaikie 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.

Then perhaps the Help Text phrasing should distinguish this behavior from the behavior of -gdwarf-N which not only sets the version, but enables emission. (perhaps the phrasing of flags that don't enable emission, like "-ggnu-pubnames" could provide inspiration for phrasing the help text for this new flag)

> From DebugInfo it seems like it's only Elf Format:

I'm curious as to why it's ELF only, though - could you explain what the motivation is there?

(random aside: I still worry about this precedent for -g* flags that sometimes enable debug info and set a feature, and sometimes they only set the feature and don't enable debug info - it's a bit of a confusing mess and I personally rather the -fdebug* flags set a feature but don't enable emission and -g* flags enable emission, but there's a lack of clear agreement and there's examples on both sides, so not sure there's much to be done about that here)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90507



More information about the cfe-commits mailing list