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>
Thu, 20 Jun 2024 11:40:40 +0000 (13:40 +0200)
Forwarded: not-needed

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

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

src/bootstrap/src/core/builder.rs

index 58f12f98ced57977d55f50ab2140fc438a29cc65..c37ab20a95b13fd13493bdbfcfc8a08b3f0804d3 100644 (file)
@@ -1459,6 +1459,18 @@ impl<'a> Builder<'a> {
         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.