[PATCH] D58909: [llvm-objdump] - Report "no zlib available" error properly when --compress-debug-sections is used.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 08:13:35 PST 2019


grimar created this revision.
grimar added reviewers: jhenderson, alexshap, jakehehrlich.
Herald added a reviewer: rupprecht.
Herald added a subscriber: jdoerfert.

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 and so
sections silently remains uncompressed in the output.

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


https://reviews.llvm.org/D58909

Files:
  tools/llvm-objcopy/CopyConfig.cpp


Index: tools/llvm-objcopy/CopyConfig.cpp
===================================================================
--- tools/llvm-objcopy/CopyConfig.cpp
+++ tools/llvm-objcopy/CopyConfig.cpp
@@ -476,11 +476,11 @@
             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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58909.189154.patch
Type: text/x-patch
Size: 790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190304/e18c9bff/attachment.bin>


More information about the llvm-commits mailing list