]> granicus.if.org Git - clang/commitdiff
[Driver] Support direct split DWARF emission for Fuchsia
authorPetr Hosek <phosek@chromium.org>
Mon, 15 Oct 2018 21:30:32 +0000 (21:30 +0000)
committerPetr Hosek <phosek@chromium.org>
Mon, 15 Oct 2018 21:30:32 +0000 (21:30 +0000)
This enables the driver support for direct split DWARF emission for
Fuchsia in addition to Linux.

Differential Revision: https://reviews.llvm.org/D53248

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

cmake/caches/Fuchsia-stage2.cmake
lib/Driver/ToolChains/Clang.cpp
test/Driver/fuchsia.c

index 0ecb50c98c0d13e7f6a87ed4b2d04f8653bf4748..836691360627e3a47589df00124736a29f69a055 100644 (file)
@@ -133,6 +133,7 @@ set(LLVM_TOOLCHAIN_TOOLS
   llvm-cov
   llvm-cxxfilt
   llvm-dwarfdump
+  llvm-dwp
   llvm-lib
   llvm-nm
   llvm-objcopy
index 4d2cb14a51bb16600ead87650b95a9e89de089e1..322a02d9597d15c859e01558bf2e1e4db073b626 100644 (file)
@@ -3047,8 +3047,8 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
 
   // -gsplit-dwarf should turn on -g and enable the backend dwarf
   // splitting and extraction.
-  // FIXME: Currently only works on Linux.
-  if (T.isOSLinux()) {
+  // FIXME: Currently only works on Linux and Fuchsia.
+  if (T.isOSLinux() || T.isOSFuchsia()) {
     if (!SplitDWARFInlining)
       CmdArgs.push_back("-fno-split-dwarf-inlining");
 
@@ -3814,7 +3814,8 @@ 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 = SplitDWARFArg && RawTriple.isOSLinux() &&
+  bool SplitDWARF = SplitDWARFArg &&
+                    (RawTriple.isOSLinux() || RawTriple.isOSFuchsia()) &&
                     (isa<AssembleJobAction>(JA) || isa<CompileJobAction>(JA) ||
                      isa<BackendJobAction>(JA));
   const char *SplitDWARFOut;
@@ -5759,8 +5760,9 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
   CmdArgs.push_back("-o");
   CmdArgs.push_back(Output.getFilename());
 
+  const llvm::Triple &T = getToolChain().getTriple();
   if (Args.hasArg(options::OPT_gsplit_dwarf) &&
-      getToolChain().getTriple().isOSLinux()) {
+      (T.isOSLinux() || T.isOSFuchsia())) {
     CmdArgs.push_back("-split-dwarf-file");
     CmdArgs.push_back(SplitDebugName(Args, Input));
   }
index f4bf003994372e5e1d43db86e2268c3f95a20dac..b26ab0417efb40a90a77fe3abce849b0409cbba3 100644 (file)
 // CHECK-THINLTO: "-plugin-opt=mcpu=x86-64"
 // CHECK-THINLTO: "-plugin-opt=thinlto"
 // CHECK-THINLTO: "-plugin-opt=jobs=8"
+
+// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN:     -gsplit-dwarf -c %s 2>&1 \
+// RUN:     | FileCheck %s -check-prefix=CHECK-SPLIT-DWARF
+// CHECK-SPLIT-DWARF: "-split-dwarf-file" "fuchsia.dwo"