From c5c238474de7025cec3fa8882d4052e107a69f2c Mon Sep 17 00:00:00 2001 From: msizanoen1 <55322658+msizanoen1@users.noreply.github.com> Date: Thu, 5 Dec 2019 23:07:42 +0700 Subject: [PATCH] Enable -fPIC on non-bare-metal RISC-V (#461) --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d795e5a6..726d1286 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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.