r370779 - clang: default to DWARF 4 for FreeBSD 12.0 and later

Ed Maste via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 09:30:21 PDT 2019


Author: emaste
Date: Tue Sep  3 09:30:21 2019
New Revision: 370779

URL: http://llvm.org/viewvc/llvm-project?rev=370779&view=rev
Log:
clang: default to DWARF 4 for FreeBSD 12.0 and later

Older FreeBSD versions included GDB 6.1 and had other tools that were
unable to handle debug information newer than DWARF 2.  Those tools have
since been updated.  (An old version of GDB is still kept for kernel
crash handling, but the kernel is compiled with an explicit -gdwarf2.)

Reviewed by:	dim
Differential Revision:	https://reviews.llvm.org/D66760

Modified:
    cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
    cfe/trunk/lib/Driver/ToolChains/FreeBSD.h
    cfe/trunk/test/Driver/debug-options.c

Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp?rev=370779&r1=370778&r2=370779&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp Tue Sep  3 09:30:21 2019
@@ -364,6 +364,12 @@ ToolChain::CXXStdlibType FreeBSD::GetDef
   return ToolChain::CST_Libstdcxx;
 }
 
+unsigned FreeBSD::GetDefaultDwarfVersion() const {
+  if (getTriple().getOSMajorVersion() < 12)
+    return 2;
+  return 4;
+}
+
 void FreeBSD::addLibStdCxxIncludePaths(
     const llvm::opt::ArgList &DriverArgs,
     llvm::opt::ArgStringList &CC1Args) const {

Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/FreeBSD.h?rev=370779&r1=370778&r2=370779&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/FreeBSD.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/FreeBSD.h Tue Sep  3 09:30:21 2019
@@ -69,7 +69,7 @@ public:
       const llvm::opt::ArgList &Args) const override;
   bool isPIEDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
-  unsigned GetDefaultDwarfVersion() const override { return 2; }
+  unsigned GetDefaultDwarfVersion() const override;
   // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
   // FreeBSD defaults to standalone/full debug info.
   bool GetDefaultStandaloneDebug() const override { return true; }

Modified: cfe/trunk/test/Driver/debug-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=370779&r1=370778&r2=370779&view=diff
==============================================================================
--- cfe/trunk/test/Driver/debug-options.c (original)
+++ cfe/trunk/test/Driver/debug-options.c Tue Sep  3 09:30:21 2019
@@ -66,8 +66,12 @@
 // RUN:                         -check-prefix=G_DWARF4 %s
 
 // FreeBSD.
-// RUN: %clang -### -c -g %s -target x86_64-pc-freebsd10.0 2>&1 \
-// RUN:             | FileCheck -check-prefix=G_GDB %s
+// RUN: %clang -### -c -g %s -target x86_64-pc-freebsd11.0 2>&1 \
+// RUN:             | FileCheck -check-prefix=G_GDB \
+// RUN:                         -check-prefix=G_DWARF2 %s
+// RUN: %clang -### -c -g %s -target x86_64-pc-freebsd12.0 2>&1 \
+// RUN:             | FileCheck -check-prefix=G_GDB \
+// RUN:                         -check-prefix=G_DWARF4 %s
 
 // Windows.
 // RUN: %clang -### -c -g %s -target x86_64-w64-windows-gnu 2>&1 \




More information about the cfe-commits mailing list