]> granicus.if.org Git - clang/commitdiff
Enable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 28 Apr 2017 20:50:25 +0000 (20:50 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 28 Apr 2017 20:50:25 +0000 (20:50 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301684 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Clang.cpp
test/Driver/split-debug.c

index 6e1e4ccf44f05c4c8f1dc060af8cc6a8f70a4d36..555847aeeb23d272355b5ce75c36ed82bcb7c8d3 100644 (file)
@@ -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
index c12164b4e2f1b6839ac0c96ad418b4ef36556669..52f53d3e712ed5df1e13d3dbcf6950babe45ccb1 100644 (file)
 // 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
 //