[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 21 11:21:57 PDT 2020


MaskRay created this revision.
MaskRay added reviewers: aprantl, dblaikie, echristo, JDevlieghere, jhenderson, probinson, thakis.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

RFC: http://lists.llvm.org/pipermail/cfe-dev/2020-May/065430.html
Agreement from GCC: https://sourceware.org/pipermail/gcc-patches/2020-May/545688.html

g_flags_Group options generally don't affect the amount of debugging
information. -gsplit-dwarf is an exception. Its order dependency with
other gN_Group options make it inconvenient in a build system:

- -g0 -gsplit-dwarf -> level 2 -gsplit-dwarf "upgrades" the amount of debugging information despite the previous intention (-g0) to drop debugging information
- -g1 -gsplit-dwarf -> level 2 -gsplit-dwarf "upgrades" the amount of debugging information.
- If we have a higher-level -gN, -gN -gsplit-dwarf will supposedly decrease the amount of debugging information. This happens with GCC -g3.

The non-orthogonality has confused many users. This patch fixes the
problem by dropping the -g2 implication of -gsplit-dwarf. New semantics:

- If there is a g_Group, allow split DWARF. (There are still conditions split DWARF is disabled if it is not beneficial: -g0, -gline-directives-only, -g1 -fno-split-dwarf-inlining)
- Otherwise, no-op.

To restore the original behavior, replace -gsplit-dwarf with -gsplit-dwarf -g.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80391

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/debug-options.c
  clang/test/Driver/fuchsia.c
  clang/test/Driver/split-debug.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80391.265552.patch
Type: text/x-patch
Size: 9498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200521/7a60b065/attachment-0001.bin>


More information about the cfe-commits mailing list