d-bootstrap-rustflags
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Thu, 14 Jul 2022 11:17:38 +0000 (13:17 +0200)
committerFabian Grünbichler <debian@fabian.gruenbichler.email>
Fri, 26 Dec 2025 19:54:51 +0000 (20:54 +0100)
Forwarded: not-needed

===================================================================

Gbp-Pq: Topic build
Gbp-Pq: Name d-bootstrap-rustflags.patch

src/bootstrap/src/core/builder/cargo.rs

index c018aedb084a516a616bfefd5289a20b5450679d..07996af539cca5924271564a293b1e7b76a27da1 100644 (file)
@@ -701,6 +701,18 @@ impl Builder<'_> {
             hostflags.arg("--cfg=bootstrap");
         }
 
+        // 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.