d-bootstrap-rustflags
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Fri, 22 Oct 2021 22:29:14 +0000 (23:29 +0100)
committerXimin Luo <infinity0@debian.org>
Fri, 22 Oct 2021 22:29:14 +0000 (23:29 +0100)
Gbp-Pq: Name d-bootstrap-rustflags.patch

src/bootstrap/builder.rs

index c325342b218ff2d0bf3c948994e0135e8a5b4ea4..0ec8b923377748cadd0394ab5fe7d88b92a37cc3 100644 (file)
@@ -974,6 +974,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.