r344556 - [Driver] Support direct split DWARF emission for Fuchsia

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 15 14:30:33 PDT 2018


Author: phosek
Date: Mon Oct 15 14:30:32 2018
New Revision: 344556

URL: http://llvm.org/viewvc/llvm-project?rev=344556&view=rev
Log:
[Driver] Support direct split DWARF emission for Fuchsia

This enables the driver support for direct split DWARF emission for
Fuchsia in addition to Linux.

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

Modified:
    cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
    cfe/trunk/lib/Driver/ToolChains/Clang.cpp
    cfe/trunk/test/Driver/fuchsia.c

Modified: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Fuchsia-stage2.cmake?rev=344556&r1=344555&r2=344556&view=diff
==============================================================================
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Mon Oct 15 14:30:32 2018
@@ -133,6 +133,7 @@ set(LLVM_TOOLCHAIN_TOOLS
   llvm-cov
   llvm-cxxfilt
   llvm-dwarfdump
+  llvm-dwp
   llvm-lib
   llvm-nm
   llvm-objcopy

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=344556&r1=344555&r2=344556&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Oct 15 14:30:32 2018
@@ -3047,8 +3047,8 @@ static void RenderDebugOptions(const Too
 
   // -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,
 
   // 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 &
   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));
   }

Modified: cfe/trunk/test/Driver/fuchsia.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fuchsia.c?rev=344556&r1=344555&r2=344556&view=diff
==============================================================================
--- cfe/trunk/test/Driver/fuchsia.c (original)
+++ cfe/trunk/test/Driver/fuchsia.c Mon Oct 15 14:30:32 2018
@@ -149,3 +149,8 @@
 // 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"




More information about the cfe-commits mailing list