diff options
-rw-r--r-- | test/MC/ELF/nocompression.s | 5 | ||||
-rw-r--r-- | test/lit.cfg | 2 | ||||
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 7 |
3 files changed, 13 insertions, 1 deletions
diff --git a/test/MC/ELF/nocompression.s b/test/MC/ELF/nocompression.s new file mode 100644 index 0000000000..c584e181df --- /dev/null +++ b/test/MC/ELF/nocompression.s @@ -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 diff --git a/test/lit.cfg b/test/lit.cfg index ec5b52ef47..df1850a663 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -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 diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index b2e7a81488..dfa347e764 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -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. |