Browse Source

Enable -fPIC on non-bare-metal RISC-V (#461)

master
msizanoen1 5 years ago
committed by Alex Crichton
parent
commit
c5c238474d
  1. 10
      src/lib.rs

10
src/lib.rs

@ -1365,11 +1365,11 @@ impl Build {
cmd.push_cc_arg("-ffunction-sections".into()); cmd.push_cc_arg("-ffunction-sections".into());
cmd.push_cc_arg("-fdata-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 // Disable generation of PIC on bare-metal RISC-V for now: rust-lld doesn't support this yet
if self if self.pic.unwrap_or(
.pic !target.contains("windows-gnu")
.unwrap_or(!target.contains("windows-gnu") && !target.contains("riscv")) && !(target.contains("riscv") && target.contains("-none-")),
{ ) {
cmd.push_cc_arg("-fPIC".into()); cmd.push_cc_arg("-fPIC".into());
// PLT only applies if code is compiled with PIC support, // PLT only applies if code is compiled with PIC support,
// and only for ELF targets. // and only for ELF targets.

Loading…
Cancel
Save