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 theGCC 11 will change the semantics
problem by dropping the -g2(-gsplit-dwarf no longer implication of -gsplit-dwarf. New semantics:
* Ifies -g2) despite there is a g_Group, allow split DWARF backwards compatibility break.
(There are still conditions split DWARF is disabled if it is not beneficial:This patch matches its behavior.
* If there is a g_Group, allow split DWARF if useful:
(not one of the following: -g0, -gline-directives-only, -g1 -fno-split-dwarf-inlining)
* Otherwise, no-op.
To restore the original behavior, replace -gsplit-dwarf with -gsplit-dwarf -g.