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>
Wed, 4 Sep 2024 18:13:19 +0000 (20:13 +0200)
Forwarded: not-needed

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

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

src/bootstrap/src/core/builder.rs

index e41070cc8f5dd79ba2ed7f6653d9ca73a9c7c759..3e1954797501f855e98d9acbfbb36f5edd5c8296 100644 (file)
@@ -1561,6 +1561,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.