[PATCH] Enable -fPIC on non-bare-metal RISC-V
authormsizanoen1 <qtmlabs@protonmail.com>
Thu, 5 Dec 2019 05:22:41 +0000 (12:22 +0700)
committerEmilio Pozuelo Monfort <pochu@debian.org>
Tue, 8 Sep 2020 16:38:19 +0000 (17:38 +0100)
Gbp-Pq: Name u-riscv64-cc-461.patch

vendor/cc/src/lib.rs

index 621d31d6b8a95b6cebc1a8cdcfc3df882e99f5ba..ab0bdf6c816cfb75928d10f8b01adf57fe1279f5 100644 (file)
@@ -1365,11 +1365,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.