diff options
| author | David Blaikie <dblaikie@gmail.com> | 2017-04-28 20:50:25 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2017-04-28 20:50:25 +0000 |
| commit | 9bb296cb05284fedf407dd1424bceb214991f5f2 (patch) | |
| tree | f7f1835e4f9bef1b77add446ff52fdda7b0e28f5 | |
| parent | 3012b371fd1163ef6d269209bfd8e8dfbae59379 (diff) | |
| download | bcm5719-llvm-9bb296cb05284fedf407dd1424bceb214991f5f2.tar.gz bcm5719-llvm-9bb296cb05284fedf407dd1424bceb214991f5f2.zip | |
Enable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.
Since -gsplit-dwarf is specified on a backend compile (in ThinLTO
parlance) it isn't passed during the frontend compile (because no ELF
object/dwo file is produced then), yet the -fno-split-dwarf-inlining
value needs to be encoded in the LLVM DebugInfo metadata to have
effect...
So let it be specified & it'll be silently ignored if -gsplit-dwarf
isn't used in the end, otherwise it'll be used on a per-cu basis
depending on where it's specified in the frontend compile actions.
llvm-svn: 301684
| -rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 10 | ||||
| -rw-r--r-- | clang/test/Driver/split-debug.c | 7 |
2 files changed, 13 insertions, 4 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 6e1e4ccf44f..555847aeeb2 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2773,12 +2773,14 @@ 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() && SplitDwarfArg) { + if (getToolChain().getTriple().isOSLinux()) { if (!splitDwarfInlining) CmdArgs.push_back("-fno-split-dwarf-inlining"); - if (DebugInfoKind == codegenoptions::NoDebugInfo) - DebugInfoKind = codegenoptions::LimitedDebugInfo; - CmdArgs.push_back("-enable-split-dwarf"); + if (SplitDwarfArg) { + if (DebugInfoKind == codegenoptions::NoDebugInfo) + DebugInfoKind = codegenoptions::LimitedDebugInfo; + CmdArgs.push_back("-enable-split-dwarf"); + } } // After we've dealt with all combinations of things that could diff --git a/clang/test/Driver/split-debug.c b/clang/test/Driver/split-debug.c index c12164b4e2f..52f53d3e712 100644 --- a/clang/test/Driver/split-debug.c +++ b/clang/test/Driver/split-debug.c @@ -40,6 +40,13 @@ // CHECK-GMLT-WITH-SPLIT: "-debug-info-kind=line-tables-only" // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-file" +// RUN: %clang -target x86_64-unknown-linux-gnu -g -fno-split-dwarf-inlining -S -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-NOINLINE-WITHOUT-SPLIT < %t %s +// +// CHECK-NOINLINE-WITHOUT-SPLIT-NOT: "-enable-split-dwarf" +// CHECK-NOINLINE-WITHOUT-SPLIT: "-fno-split-dwarf-inlining" +// CHECK-NOINLINE-WITHOUT-SPLIT: "-debug-info-kind=limited" + // RUN: %clang -target x86_64-unknown-linux-gnu -gmlt -gsplit-dwarf -fno-split-dwarf-inlining -S -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-SPLIT-WITH-GMLT < %t %s // |

