Enable -fPIC on non-bare-metal RISC-V
authormsizanoen1 <qtmlabs@protonmail.com>
Thu, 5 Dec 2019 05:22:41 +0000 (12:22 +0700)
committerXimin Luo <infinity0@debian.org>
Sun, 5 Jan 2020 13:35:46 +0000 (13:35 +0000)
Gbp-Pq: Name u-riscv64-cc-461.patch

vendor/cc/src/lib.rs

index 3d5cb8daf8f10d0fcfb19a55c9442b01f9de963f..caadb5dfd88ab38172ccda6dbd0610e6b2142c71 100644 (file)
@@ -1219,11 +1219,11 @@ impl Build {
                     cmd.push_cc_arg("-ffunction-sections".into());
                     cmd.push_cc_arg("-fdata-sections".into());
                 }
-                // Disable generation of PIC on RISC-V for now: rust-lld doesn't support this yet
-                if self
-                    .pic
-                    .unwrap_or(!target.contains("windows-gnu") && !target.contains("riscv"))
-                {
+                // Disable generation of PIC on bare-metal RISC-V for now: rust-lld doesn't support this yet
+                if self.pic.unwrap_or(
+                    !target.contains("windows-gnu")
+                        && !(target.contains("riscv") && target.contains("-none-")),
+                {
                     cmd.push_cc_arg("-fPIC".into());
                     // PLT only applies if code is compiled with PIC support,
                     // and only for ELF targets.