[PATCH] Allow -gsplit-dwarf for all ELF targets, not just Linux

Ed Maste emaste at freebsd.org
Mon Mar 23 08:01:29 PDT 2015


Enable -gsplit-dwarf explicitly for FreeBSD as well - no consensus for the previous patch enabling for all ELF targets at present.


http://reviews.llvm.org/D8484

Files:
  lib/Driver/Tools.cpp
  test/Driver/split-debug.c

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3289,8 +3289,9 @@
   // FIXME: Move backend command line options to the module.
   // -gsplit-dwarf should turn on -g and enable the backend dwarf
   // splitting and extraction.
-  // FIXME: Currently only works on Linux.
-  if (getToolChain().getTriple().isOSLinux() &&
+  // FIXME: Currently only works on FreeBSD and Linux.
+  if ((getToolChain().getTriple().isOSFreeBSD() ||
+       getToolChain().getTriple().isOSLinux()) &&
       Args.hasArg(options::OPT_gsplit_dwarf)) {
     CmdArgs.push_back("-g");
     CmdArgs.push_back("-backend-option");
@@ -4621,7 +4622,8 @@
   // Add the split debug info name to the command lines here so we
   // can propagate it to the backend.
   bool SplitDwarf = Args.hasArg(options::OPT_gsplit_dwarf) &&
-    getToolChain().getTriple().isOSLinux() &&
+    (getToolChain().getTriple().isOSFreeBSD() ||
+     getToolChain().getTriple().isOSLinux()) &&
     (isa<AssembleJobAction>(JA) || isa<CompileJobAction>(JA) ||
      isa<BackendJobAction>(JA));
   const char *SplitDwarfOut;
@@ -5120,9 +5122,10 @@
 
   // Handle the debug info splitting at object creation time if we're
   // creating an object.
-  // TODO: Currently only works on linux with newer objcopy.
+  // TODO: Currently only works on FreeBSD and Linux with newer objcopy.
   if (Args.hasArg(options::OPT_gsplit_dwarf) &&
-      getToolChain().getTriple().isOSLinux())
+      (getToolChain().getTriple().isOSFreeBSD() ||
+       getToolChain().getTriple().isOSLinux()))
     SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
                    SplitDebugName(Args, Inputs));
 }
@@ -7448,9 +7451,10 @@
 
   // Handle the debug info splitting at object creation time if we're
   // creating an object.
-  // TODO: Currently only works on linux with newer objcopy.
+  // TODO: Currently only works on FreeBSD and Linux with newer objcopy.
   if (Args.hasArg(options::OPT_gsplit_dwarf) &&
-      getToolChain().getTriple().isOSLinux())
+      (getToolChain().getTriple().isOSFreeBSD() ||
+       getToolChain().getTriple().isOSLinux()))
     SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
                    SplitDebugName(Args, Inputs));
 }
Index: test/Driver/split-debug.c
===================================================================
--- test/Driver/split-debug.c
+++ test/Driver/split-debug.c
@@ -6,6 +6,11 @@
 // CHECK-ACTIONS: objcopy{{.*}}--extract-dwo{{.*}}"split-debug.dwo"
 // CHECK-ACTIONS: objcopy{{.*}}--strip-dwo{{.*}}"split-debug.o"
 
+// RUN: %clang -target aarch64-unknown-freebsd -gsplit-dwarf -c -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-FREEBSD-ACTIONS < %t %s
+//
+// CHECK-FREEBSD-ACTIONS: objcopy{{.*}}--extract-dwo{{.*}}"split-debug.dwo"
+// CHECK-FREEBSD-ACTIONS: objcopy{{.*}}--strip-dwo{{.*}}"split-debug.o"
 
 // RUN: %clang -target x86_64-macosx -gsplit-dwarf -c -### %s 2> %t
 // RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8484.22469.patch
Type: text/x-patch
Size: 3055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150323/15e65684/attachment.bin>


More information about the cfe-commits mailing list