d-bootstrap-rustflags
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Tue, 8 Mar 2022 10:51:18 +0000 (10:51 +0000)
committerXimin Luo <infinity0@debian.org>
Tue, 8 Mar 2022 10:51:18 +0000 (10:51 +0000)
Gbp-Pq: Name d-bootstrap-rustflags.patch

src/bootstrap/builder.rs

index 83ab200a24e8f77b85be456ec240f991f7519410..05eb0b664b85183cae7253f89c48ce64b7e08307 100644 (file)
@@ -974,6 +974,18 @@ impl<'a> Builder<'a> {
             rustflags.arg("-Zsymbol-mangling-version=v0");
         }
 
+        // Debian-specific stuff here
+        // 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.