Skip to content

Commit 349f6bf

Browse files
committed
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.
2 parents 7adbc0d + 8caa14f commit 349f6bf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bootstrap/native.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ impl Step for Llvm {
158158
.define("LLVM_INCLUDE_TESTS", "OFF")
159159
.define("LLVM_INCLUDE_DOCS", "OFF")
160160
.define("LLVM_INCLUDE_BENCHMARKS", "OFF")
161-
.define("LLVM_ENABLE_ZLIB", "OFF")
162161
.define("WITH_POLLY", "OFF")
163162
.define("LLVM_ENABLE_TERMINFO", "OFF")
164163
.define("LLVM_ENABLE_LIBEDIT", "OFF")
@@ -168,6 +167,14 @@ impl Step for Llvm {
168167
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
169168
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
170169

170+
if !target.contains("netbsd") {
171+
cfg.define("LLVM_ENABLE_ZLIB", "ON");
172+
} else {
173+
// FIXME: Enable zlib on NetBSD too
174+
// https://github.com/rust-lang/rust/pull/72696#issuecomment-641517185
175+
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
176+
}
177+
171178
if builder.config.llvm_thin_lto {
172179
cfg.define("LLVM_ENABLE_LTO", "Thin");
173180
if !target.contains("apple") {

0 commit comments

Comments
 (0)