diff options
author | David Blaikie <dblaikie@gmail.com> | 2016-08-24 23:22:36 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2016-08-24 23:22:36 +0000 |
commit | 3d0a039e9617667af482be751e1c6363a40e35bf (patch) | |
tree | b3d3dba7d4d90c787950e021f2306213db82cc3a /clang/lib/Driver/Tools.cpp | |
parent | 41bcb830af72e49105f3d8056e4863bad931b7bf (diff) | |
download | llvm-3d0a039e9617667af482be751e1c6363a40e35bf.zip llvm-3d0a039e9617667af482be751e1c6363a40e35bf.tar.gz llvm-3d0a039e9617667af482be751e1c6363a40e35bf.tar.bz2 |
DebugInfo: Let -gsplit-dwarf and -gmlt compose if -fno-split-dwarf-inlining is used
If the inline info is not duplicated into the skeleton CU, then there's
value in using -gsplit-dwarf and -gmlt together (to keep all those extra
subprograms out of the skeleton CU, while also producing smaller .dwo
files)
llvm-svn: 279687
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index c1d68bc..2db1b60 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -4597,6 +4597,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, : "-"); } + bool splitDwarfInlining = + Args.hasFlag(options::OPT_fsplit_dwarf_inlining, + options::OPT_fno_split_dwarf_inlining, true); + if (!splitDwarfInlining) + CmdArgs.push_back("-fno-split-dwarf-inlining"); + Args.ClaimAllArgs(options::OPT_g_Group); Arg *SplitDwarfArg = Args.getLastArg(options::OPT_gsplit_dwarf); if (Arg *A = Args.getLastArg(options::OPT_g_Group)) { @@ -4606,8 +4612,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // If you say "-gsplit-dwarf -gline-tables-only", -gsplit-dwarf loses. // But -gsplit-dwarf is not a g_group option, hence we have to check the // order explicitly. (If -gsplit-dwarf wins, we fix DebugInfoKind later.) - if (SplitDwarfArg && DebugInfoKind < codegenoptions::LimitedDebugInfo && - A->getIndex() > SplitDwarfArg->getIndex()) + // This gets a bit more complicated if you've disabled inline info in the + // skeleton CUs (splitDwarfInlining) - then there's value in composing + // split-dwarf and line-tables-only, so let those compose naturally in + // that case. + // And if you just turned off debug info, (-gsplit-dwarf -g0) - do that. + if (SplitDwarfArg && A->getIndex() > SplitDwarfArg->getIndex() && + ((DebugInfoKind == codegenoptions::DebugLineTablesOnly && + splitDwarfInlining) || + DebugInfoKind == codegenoptions::NoDebugInfo)) SplitDwarfArg = nullptr; } else // For any other 'g' option, use Limited. @@ -4659,7 +4672,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // splitting and extraction. // FIXME: Currently only works on Linux. if (getToolChain().getTriple().isOSLinux() && SplitDwarfArg) { - DebugInfoKind = codegenoptions::LimitedDebugInfo; + if (splitDwarfInlining) + DebugInfoKind = codegenoptions::LimitedDebugInfo; CmdArgs.push_back("-backend-option"); CmdArgs.push_back("-split-dwarf=Enable"); } @@ -4697,10 +4711,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-generate-type-units"); } - if (!Args.hasFlag(options::OPT_fsplit_dwarf_inlining, - options::OPT_fno_split_dwarf_inlining, true)) - CmdArgs.push_back("-fno-split-dwarf-inlining"); - // CloudABI and WebAssembly use -ffunction-sections and -fdata-sections by // default. bool UseSeparateSections = Triple.getOS() == llvm::Triple::CloudABI || |