summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-07-30 21:42:22 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-07-30 21:42:22 +0000
commitce3e7a614a537327cfb57e1918487ee8c0095b26 (patch)
tree7aec6921d03c262af8c8703807f008c568887fe8 /clang/lib/Driver
parent1166f2ff9f30a84fea630888b297bf58c3dba7e9 (diff)
downloadbcm5719-llvm-ce3e7a614a537327cfb57e1918487ee8c0095b26.tar.gz
bcm5719-llvm-ce3e7a614a537327cfb57e1918487ee8c0095b26.zip
Split DWARF: Allow -gmlt/-gsplit-dwarf to override rather than complement each other
It doesn't make any sense to enable -gmlt with -gsplit-dwarf, since -gmlt is designed for on-line symbolication (and -gsplit-dwarf normally emits all the -gmlt data into the .o anyway - so there's nothing to split out except redundant/duplicate info). With this change they override each other, -gmlt -gsplit-dwarf is the same as -gsplit-dwarf and -gsplit-dwarf -gmlt is the same as -gmlt. llvm-svn: 243694
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/Tools.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 8bbc92db65b..ce39b872eea 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -3644,9 +3644,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Use the last option from "-g" group. "-gline-tables-only" and "-gdwarf-x"
// are preserved, all other debug options are substituted with "-g".
Args.ClaimAllArgs(options::OPT_g_Group);
+ Arg *SplitDwarfArg = Args.getLastArg(options::OPT_gsplit_dwarf);
if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
- if (A->getOption().matches(options::OPT_gline_tables_only) ||
- A->getOption().matches(options::OPT_g1)) {
+ if ((A->getOption().matches(options::OPT_gline_tables_only) ||
+ A->getOption().matches(options::OPT_g1)) &&
+ (!SplitDwarfArg || A->getIndex() > SplitDwarfArg->getIndex())) {
// FIXME: we should support specifying dwarf version with
// -gline-tables-only.
CmdArgs.push_back("-gline-tables-only");
@@ -3656,6 +3658,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Triple.getOS() == llvm::Triple::FreeBSD ||
Triple.getOS() == llvm::Triple::Solaris)
CmdArgs.push_back("-gdwarf-2");
+ SplitDwarfArg = nullptr;
} else if (A->getOption().matches(options::OPT_gdwarf_2))
CmdArgs.push_back("-gdwarf-2");
else if (A->getOption().matches(options::OPT_gdwarf_3))
@@ -3685,8 +3688,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// -gsplit-dwarf should turn on -g and enable the backend dwarf
// splitting and extraction.
// FIXME: Currently only works on Linux.
- if (getToolChain().getTriple().isOSLinux() &&
- Args.hasArg(options::OPT_gsplit_dwarf)) {
+ if (getToolChain().getTriple().isOSLinux() && SplitDwarfArg) {
CmdArgs.push_back("-g");
CmdArgs.push_back("-backend-option");
CmdArgs.push_back("-split-dwarf=Enable");
@@ -4970,8 +4972,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Add the split debug info name to the command lines here so we
// can propagate it to the backend.
- bool SplitDwarf = Args.hasArg(options::OPT_gsplit_dwarf) &&
- getToolChain().getTriple().isOSLinux() &&
+ bool SplitDwarf = SplitDwarfArg && getToolChain().getTriple().isOSLinux() &&
(isa<AssembleJobAction>(JA) || isa<CompileJobAction>(JA) ||
isa<BackendJobAction>(JA));
const char *SplitDwarfOut;
OpenPOWER on IntegriCloud