r205265 - Warn when requesting compress-debug-sections and zlib is not available

David Blaikie dblaikie at gmail.com
Mon Mar 31 16:29:38 PDT 2014


Author: dblaikie
Date: Mon Mar 31 18:29:38 2014
New Revision: 205265

URL: http://llvm.org/viewvc/llvm-project?rev=205265&view=rev
Log:
Warn when requesting compress-debug-sections and zlib is not available

Another shot in the dark, since I do have zlib installed. Will be
watching the bots for fallout.

Added:
    cfe/trunk/test/Driver/compress.c
Modified:
    cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=205265&r1=205264&r2=205265&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Mon Mar 31 18:29:38 2014
@@ -152,6 +152,8 @@ def warn_drv_pch_not_first_include : War
   "precompiled header '%0' was ignored because '%1' is not first '-include'">;
 def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
   InGroup<DiagGroup<"missing-sysroot">>;
+def warn_debug_compression_unavailable : Warning<"cannot compress debug sections (zlib not installed)">,
+  InGroup<DiagGroup<"debug-compression-unavailable">>;
 
 def note_drv_command_failed_diag_msg : Note<
   "diagnostic msg: %0">;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=205265&r1=205264&r2=205265&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Mar 31 18:29:38 2014
@@ -29,6 +29,7 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
+#include "llvm/Support/Compression.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Format.h"
@@ -1823,8 +1824,12 @@ static void CollectArgsForIntegratedAsse
         }
       }
     }
-    if (CompressDebugSections)
-      CmdArgs.push_back("-compress-debug-sections");
+    if (CompressDebugSections) {
+      if (llvm::zlib::isAvailable())
+        CmdArgs.push_back("-compress-debug-sections");
+      else
+        D.Diag(diag::warn_debug_compression_unavailable);
+    }
 }
 
 // Until ARM libraries are build separately, we have them all in one library

Added: cfe/trunk/test/Driver/compress.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/compress.c?rev=205265&view=auto
==============================================================================
--- cfe/trunk/test/Driver/compress.c (added)
+++ cfe/trunk/test/Driver/compress.c Mon Mar 31 18:29:38 2014
@@ -0,0 +1,4 @@
+// RUN: %clang -c %s -Wa,--compress-debug-sections 2>&1 | FileCheck %s
+// REQUIRES: nozlib
+
+// CHECK: warning: cannot compress debug sections (zlib not installed)





More information about the cfe-commits mailing list