about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-06-21 13:18:00 +0000
committerbors <bors@rust-lang.org>2020-06-21 13:18:00 +0000
commit349f6bfb11d73ebb6a272f9a3d00883484f8218c (patch)
treece07c565403cc0d918edfb070f70490122ab075d
parent7adbc0dfeffcb6c2ae489cc97d28f76612c7cdf3 (diff)
parent8caa14f59919ac3a8eef4345df4c1840091e2913 (diff)
downloadrust-349f6bfb11d73ebb6a272f9a3d00883484f8218c.tar.gz
rust-349f6bfb11d73ebb6a272f9a3d00883484f8218c.zip
Auto merge of #72696 - jethrogb:jb/llvm-zlib, r=Mark-Simulacrum
Enable LLVM zlib

Compilers may generate ELF objects with compressed sections (although rustc currently doesn't do this). Currently, when linking these with `rust-lld`, you'll get this error:

`rust-lld: error: ...: contains a compressed section, but zlib is not available`

This enables zlib when building LLVM.
-rw-r--r--src/bootstrap/native.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 0a14957384d..106db90b2d0 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -158,7 +158,6 @@ impl Step for Llvm {
             .define("LLVM_INCLUDE_TESTS", "OFF")
             .define("LLVM_INCLUDE_DOCS", "OFF")
             .define("LLVM_INCLUDE_BENCHMARKS", "OFF")
-            .define("LLVM_ENABLE_ZLIB", "OFF")
             .define("WITH_POLLY", "OFF")
             .define("LLVM_ENABLE_TERMINFO", "OFF")
             .define("LLVM_ENABLE_LIBEDIT", "OFF")
@@ -168,6 +167,14 @@ impl Step for Llvm {
             .define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
             .define("LLVM_DEFAULT_TARGET_TRIPLE", target);
 
+        if !target.contains("netbsd") {
+            cfg.define("LLVM_ENABLE_ZLIB", "ON");
+        } else {
+            // FIXME: Enable zlib on NetBSD too
+            // https://github.com/rust-lang/rust/pull/72696#issuecomment-641517185
+            cfg.define("LLVM_ENABLE_ZLIB", "OFF");
+        }
+
         if builder.config.llvm_thin_lto {
             cfg.define("LLVM_ENABLE_LTO", "Thin");
             if !target.contains("apple") {