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>
Tue, 21 Jan 2025 10:38:15 +0000 (11:38 +0100)
Forwarded: not-needed

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

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

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

index e1e19fd305fab8bb9851bdeac835bd9a808e9192..0e53660349a1dce40a7c0f357f64bda58bca019e 100644 (file)
@@ -625,6 +625,18 @@ impl Builder<'_> {
         hostflags.arg("-Zunstable-options");
         hostflags.arg("--check-cfg=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.