[PATCH] D53248: [Driver] Support direct split DWARF emission for Fuchsia

2018-10-15 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344556: [Driver] Support direct split DWARF emission for 
Fuchsia (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53248?vs=169582&id=169756#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53248

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


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -133,6 +133,7 @@
   llvm-cov
   llvm-cxxfilt
   llvm-dwarfdump
+  llvm-dwp
   llvm-lib
   llvm-nm
   llvm-objcopy
Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -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"
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -3047,8 +3047,8 @@
 
   // -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 @@
 
   // 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(JA) || isa(JA) ||
  isa(JA));
   const char *SplitDWARFOut;
@@ -5759,8 +5760,9 @@
   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: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -133,6 +133,7 @@
   llvm-cov
   llvm-cxxfilt
   llvm-dwarfdump
+  llvm-dwp
   llvm-lib
   llvm-nm
   llvm-objcopy
Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -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"
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -3047,8 +3047,8 @@
 
   // -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 @@
 
   // 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(JA) || isa(JA) ||
  isa(JA));
   const char *SplitDWARFOut;
@@ -5759,8 +5760,9 @@
   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_ba

[PATCH] D53248: [Driver] Support direct split DWARF emission for Fuchsia

2018-10-13 Thread Eric Christopher via Phabricator via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

I'm ok with the "here are a bunch of fuchsia tests" file :)

-eric


Repository:
  rC Clang

https://reviews.llvm.org/D53248



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53248: [Driver] Support direct split DWARF emission for Fuchsia

2018-10-13 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

I'm fine moving the test to `test/Driver/split-debug.c` if you prefer to have 
all target tests in a single file.


Repository:
  rC Clang

https://reviews.llvm.org/D53248



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53248: [Driver] Support direct split DWARF emission for Fuchsia

2018-10-13 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: pcc, jakehehrlich, echristo.
Herald added subscribers: cfe-commits, JDevlieghere, aprantl, mgorny.

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


Repository:
  rC Clang

https://reviews.llvm.org/D53248

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


Index: clang/test/Driver/fuchsia.c
===
--- clang/test/Driver/fuchsia.c
+++ clang/test/Driver/fuchsia.c
@@ -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"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3047,8 +3047,8 @@
 
   // -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 @@
 
   // 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(JA) || isa(JA) ||
  isa(JA));
   const char *SplitDWARFOut;
@@ -5752,8 +5753,9 @@
   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: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -133,6 +133,7 @@
   llvm-cov
   llvm-cxxfilt
   llvm-dwarfdump
+  llvm-dwp
   llvm-lib
   llvm-nm
   llvm-objcopy


Index: clang/test/Driver/fuchsia.c
===
--- clang/test/Driver/fuchsia.c
+++ clang/test/Driver/fuchsia.c
@@ -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"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3047,8 +3047,8 @@
 
   // -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 @@
 
   // 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(JA) || isa(JA) ||
  isa(JA));
   const char *SplitDWARFOut;
@@ -5752,8 +5753,9 @@
   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: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -133,6 +133,7 @@
   llvm-cov
   llvm-cxxfilt
   llvm-dwarfdump
+  llvm-dwp
   llvm-lib
   llvm-nm
   llvm-objcopy
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.