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 Gruenbichler <debian@fabian.gruenbichler.email>
Sat, 14 Jan 2023 08:38:46 +0000 (08:38 +0000)
===================================================================

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

src/bootstrap/builder.rs

index 144aefa2c213b7502183af8fce996f3e6f775de6..082410fe6f8c0d01d9ff010f456b94ac7aa472e8 100644 (file)
@@ -1502,6 +1502,18 @@ impl<'a> Builder<'a> {
             }
         }
 
+        // 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.