[PATCH] D59923: [Driver] Simplify -g level computation and its interaction with -gsplit-dwarf

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 21:26:35 PDT 2019


MaskRay added a comment.

> is that to imply that the first block all do not use split DWARF?

The first block do not use split DWARF.

> In a previous message I think you said that the only change was "-gmlt -gsplit-dwarf -fno-split-dwarf-inlining => 1 (before) 2 (after)" - which I'm not sure is an improvement.

Yes, this is the only behavioral change.

> You mentioned that the inconsistency between "-g0 -gsplit-dwarf" and "-gmlt -gsplit-dwarf -fno-split-dwarf-inlining" was confusing. But still there will be an inconsistency between "-gsplit-dwarf -g0" and "-gsplit-dwarf -gmlt -fno-split-dwarf-inlining", yes?

The debug info level will be consistent after this patch:  the last of `-gsplit-dwarf -g0 -g1 -g2 -g3 -ggdb[0-3] -gdwarf-*` will decide the debug info level (`-gsplit-dwarf -gdwarf-*` have level 2). Next, a separate rule decides if the `-gsplit-dwarf` takes effect (not if `DebugInfoKind == codegenoptions::NoDebugInfo || DebugInfoKind == codegenoptions::DebugDirectivesOnly || (DebugInfoKind == codegenoptions::DebugLineTablesOnly && SplitDWARFInlining)`)

> I think that under -fno-split-dwarf-inlining, -gmlt and -gsplit-dwarf should be order independent and compositional rather than overriding. Having them compose in one order but not the other seems confusing to me.

The existence of `-fno-split-dwarf-inlining` changing the position dependence makes me confused:

- Without it, the latter of `-gmlt` and `-gsplit-dwarf` decides the debug info level
- With it, `-gmlt` decides the debug info level

I think the order of different options relative to one another should not matter, unless the options are documented as mutually-exclusive and such an option is documented to override any incompatible options preceding it. (POSIX Utility Syntax Guideline 11) Unfortunately GCC `-gsplit-dwarf` disobeys the guideline and makes the semantics not orthogonal. Considering the need to preserve its semantics, I think it'd be better to make `-gsplit-dwarf` consistently positional dependent, rather than make it sometimes positional dependent and sometimes (in the presence of `-fno-split-dwarf-inlining`) positional independent.


Repository:
  rC Clang

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

https://reviews.llvm.org/D59923





More information about the cfe-commits mailing list