[llvm] r205050 - llvm-mc: error when -compress-debug-sections is requested and zlib is not linked

David Blaikie dblaikie at gmail.com
Fri Mar 28 13:45:25 PDT 2014


Author: dblaikie
Date: Fri Mar 28 15:45:24 2014
New Revision: 205050

URL: http://llvm.org/viewvc/llvm-project?rev=205050&view=rev
Log:
llvm-mc: error when -compress-debug-sections is requested and zlib is not linked

This is a bit of a stab in the dark, since I have zlib on my machine.
Just going to bounce it off the bots & see if it sticks.

Do we have some convention for negative REQUIRES: checks? Or do I just
need to add a feature like I've done here?

Added:
    llvm/trunk/test/MC/ELF/nocompression.s
Modified:
    llvm/trunk/test/lit.cfg
    llvm/trunk/tools/llvm-mc/llvm-mc.cpp

Added: llvm/trunk/test/MC/ELF/nocompression.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/nocompression.s?rev=205050&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/nocompression.s (added)
+++ llvm/trunk/test/MC/ELF/nocompression.s Fri Mar 28 15:45:24 2014
@@ -0,0 +1,5 @@
+// RUN: llvm-mc -filetype=obj -compress-debug-sections -triple x86_64-pc-linux-gnu %s -o - 2>&1 | FileCheck %s
+
+// REQUIRES: nozlib
+
+// CHECK: llvm-mc: build tools with zlib to enable -compress-debug-sections

Modified: llvm/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=205050&r1=205049&r2=205050&view=diff
==============================================================================
--- llvm/trunk/test/lit.cfg (original)
+++ llvm/trunk/test/lit.cfg Fri Mar 28 15:45:24 2014
@@ -297,6 +297,8 @@ if not 'hexagon' in config.target_triple
 
 if config.have_zlib == "1":
     config.available_features.add("zlib")
+else:
+    config.available_features.add("nozlib")
 
 # Native compilation: host arch == target arch
 # FIXME: Consider cases that target can be executed

Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=205050&r1=205049&r2=205050&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Fri Mar 28 15:45:24 2014
@@ -384,8 +384,13 @@ int main(int argc, char **argv) {
   std::unique_ptr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, TripleName));
   assert(MAI && "Unable to create target asm info!");
 
-  if (CompressDebugSections)
+  if (CompressDebugSections) {
+    if (!zlib::isAvailable()) {
+      errs() << ProgName << ": build tools with zlib to enable -compress-debug-sections";
+      return 1;
+    }
     MAI->setCompressDebugSections(true);
+  }
 
   // FIXME: This is not pretty. MCContext has a ptr to MCObjectFileInfo and
   // MCObjectFileInfo needs a MCContext reference in order to initialize itself.





More information about the llvm-commits mailing list