d-bootstrap-rustflags
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Thu, 4 Aug 2022 07:50:12 +0000 (08:50 +0100)
committerEmilio Pozuelo Monfort <pochu@debian.org>
Thu, 4 Aug 2022 07:50:12 +0000 (08:50 +0100)
Gbp-Pq: Name d-bootstrap-rustflags.patch

src/bootstrap/builder.rs

index 3bf0523fa5bbdd7d1b82c829782f49fe21c306d7..9c2abe63e98468821a2c6164708c741f07aad6c6 100644 (file)
@@ -1002,6 +1002,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.