Skip to content

Commit 57afb42

Browse files
stepansnigirevalexcrichton
authored andcommitted
disable pic for bare metal by default (#470)
1 parent 9228de6 commit 57afb42

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ impl Build {
847847

848848
/// Configures whether the compiler will emit position independent code.
849849
///
850-
/// This option defaults to `false` for `windows-gnu` and `riscv` targets and
850+
/// This option defaults to `false` for `windows-gnu` and bare metal targets and
851851
/// to `true` for all other targets.
852852
pub fn pic(&mut self, pic: bool) -> &mut Build {
853853
self.pic = Some(pic);
@@ -1371,11 +1371,11 @@ impl Build {
13711371
cmd.push_cc_arg("-ffunction-sections".into());
13721372
cmd.push_cc_arg("-fdata-sections".into());
13731373
}
1374-
// Disable generation of PIC on bare-metal RISC-V for now: rust-lld doesn't support this yet
1375-
if self.pic.unwrap_or(
1376-
!target.contains("windows-gnu")
1377-
&& !(target.contains("riscv") && target.contains("-none-")),
1378-
) {
1374+
// Disable generation of PIC on bare-metal for now: rust-lld doesn't support this yet
1375+
if self
1376+
.pic
1377+
.unwrap_or(!target.contains("windows-gnu") && !target.contains("-none-"))
1378+
{
13791379
cmd.push_cc_arg("-fPIC".into());
13801380
// PLT only applies if code is compiled with PIC support,
13811381
// and only for ELF targets.

0 commit comments

Comments
 (0)