Skip to content

Commit 13e04b1

Browse files
authored
Merge pull request #430 from laanwj/2019_08_rv_nopic
risc-v: Disable PIC by default for now
2 parents c7cd5dd + 97b648e commit 13e04b1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ impl Build {
824824

825825
/// Configures whether the compiler will emit position independent code.
826826
///
827-
/// This option defaults to `false` for `windows-gnu` targets and
827+
/// This option defaults to `false` for `windows-gnu` and `riscv` targets and
828828
/// to `true` for all other targets.
829829
pub fn pic(&mut self, pic: bool) -> &mut Build {
830830
self.pic = Some(pic);
@@ -1225,7 +1225,8 @@ impl Build {
12251225
cmd.push_cc_arg("-ffunction-sections".into());
12261226
cmd.push_cc_arg("-fdata-sections".into());
12271227
}
1228-
if self.pic.unwrap_or(!target.contains("windows-gnu")) {
1228+
// Disable generation of PIC on RISC-V for now: rust-lld doesn't support this yet
1229+
if self.pic.unwrap_or(!target.contains("windows-gnu") && !target.contains("riscv")) {
12291230
cmd.push_cc_arg("-fPIC".into());
12301231
// PLT only applies if code is compiled with PIC support,
12311232
// and only for ELF targets.

0 commit comments

Comments
 (0)