d-rustflags
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Tue, 1 Dec 2020 19:57:48 +0000 (19:57 +0000)
committerXimin Luo <infinity0@debian.org>
Tue, 1 Dec 2020 19:57:48 +0000 (19:57 +0000)
Gbp-Pq: Name d-rustflags.patch

src/bootstrap/builder.rs

index f60c7748ae32fde2dbad3c9b756d3c30ac03545d..6200ba92f85fc66a77f4b4ab9120c9ba2d99dd32 100644 (file)
@@ -829,6 +829,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.