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

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 21:46:18 PST 2020


ikudrin 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:
> > 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)
> > This enables DWARF64 if emission is enabled.
> > 
> 
> 
> 
> > 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?
> 

Our customers need DWARF64 for ELF and I do not have much experience with other platforms, so I cannot provide adequate support there. Some platform-specific tools, like `dsymutil`, have to be fixed to work with DWARF64, but I am personally a bit reluctant to do that because I cannot check the result in practice. If there will be developers who are willing to support DWARF64 on these platforms, they will be able to unlock it and use all the experience we collect with ELF, but for now, I prefer to focus on one particular platform with practical applications.


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