[llvm] r355391 - [llvm-objcopy] - Report "no zlib available" error properly when --compress-debug-sections is used.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 03:32:14 PST 2019


Author: grimar
Date: Tue Mar  5 03:32:14 2019
New Revision: 355391

URL: http://llvm.org/viewvc/llvm-project?rev=355391&view=rev
Log:
[llvm-objcopy] - Report "no zlib available" error properly when --compress-debug-sections is used.

If zlib is not available, and --compress-debug-sections is passed, 
we want to report an error. Currently, it is only reported for
--compress_debug_sections= form of the option.

Fixes the https://bugs.llvm.org/show_bug.cgi?id=40886.

I do not think there is a way to write a test for this.

Differential revision: https://reviews.llvm.org/D58909

Modified:
    llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp

Modified: llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp?rev=355391&r1=355390&r2=355391&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp Tue Mar  5 03:32:14 2019
@@ -476,11 +476,11 @@ Expected<DriverConfig> parseObjcopyOptio
             InputArgs.getLastArgValue(OBJCOPY_compress_debug_sections_eq)
                 .str()
                 .c_str());
-      if (!zlib::isAvailable())
-        return createStringError(
-            errc::invalid_argument,
-            "LLVM was not compiled with LLVM_ENABLE_ZLIB: can not compress");
     }
+    if (!zlib::isAvailable())
+      return createStringError(
+          errc::invalid_argument,
+          "LLVM was not compiled with LLVM_ENABLE_ZLIB: can not compress");
   }
 
   Config.AddGnuDebugLink = InputArgs.getLastArgValue(OBJCOPY_add_gnu_debuglink);




More information about the llvm-commits mailing list