Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

risc-v: Disable PIC by default for now #430

Merged
merged 1 commit into from Aug 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/lib.rs
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