d-rustflags
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Sat, 28 Aug 2021 09:48:11 +0000 (10:48 +0100)
committerXimin Luo <infinity0@debian.org>
Sat, 28 Aug 2021 09:48:11 +0000 (10:48 +0100)
Gbp-Pq: Name d-rustflags.patch

src/bootstrap/builder.rs

index e52954b08c4d598291a81873e4bd2e49b90d5eea..5bc2e46e034b443a4329f95402182cd0434ebeab 100644 (file)
@@ -888,6 +888,21 @@ impl<'a> Builder<'a> {
             rustflags.arg("-Zsymbol-mangling-version=v0");
         }
 
+        // Debian-specific stuff here
+        // don't error on warnings, this sometimes causes builds to fail when
+        // we re-bootstrap using the same version, that introduced a new warning
+        rustflags.arg("--cap-lints=warn");
+        // set linker flags from LDFLAGS
+        if let Ok(ldflags) = env::var("LDFLAGS") {
+            for flag in ldflags.split_whitespace() {
+                if target.contains("windows") && flag.contains("relro") {
+                    // relro is ELF-specific
+                    continue;
+                }
+                rustflags.arg(&format!("-Clink-args={}", flag));
+            }
+        }
+
         // FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
         // but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See
         // #71458.