d-bootstrap-rustflags
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Thu, 14 Jul 2022 11:17:38 +0000 (13:17 +0200)
committerJeremy Bícha <jbicha@ubuntu.com>
Mon, 26 Jun 2023 21:16:27 +0000 (22:16 +0100)
===================================================================

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

src/bootstrap/builder.rs

index 87462980627d3b6f20573b7f4eec628911871972..28154fce66e64542b4dd17306fb850f2cd798bea 100644 (file)
@@ -1500,6 +1500,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.