Skip to content

Commit

Permalink
Merge pull request #430 from laanwj/2019_08_rv_nopic
Browse files Browse the repository at this point in the history
risc-v: Disable PIC by default for now
  • Loading branch information
alexcrichton authored Aug 8, 2019
2 parents c7cd5dd + 97b648e commit 13e04b1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ impl Build {

/// Configures whether the compiler will emit position independent code.
///
/// This option defaults to `false` for `windows-gnu` targets and
/// This option defaults to `false` for `windows-gnu` and `riscv` targets and
/// to `true` for all other targets.
pub fn pic(&mut self, pic: bool) -> &mut Build {
self.pic = Some(pic);
Expand Down Expand Up @@ -1225,7 +1225,8 @@ impl Build {
cmd.push_cc_arg("-ffunction-sections".into());
cmd.push_cc_arg("-fdata-sections".into());
}
if self.pic.unwrap_or(!target.contains("windows-gnu")) {
// 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")) {
cmd.push_cc_arg("-fPIC".into());
// PLT only applies if code is compiled with PIC support,
// and only for ELF targets.
Expand Down

0 comments on commit 13e04b1

Please sign in to comment.