Skip to content

Commit c1f07fc

Browse files
authored
Don't pass -fPIC by default on wasm
Fix #1240
1 parent 53a0b97 commit c1f07fc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/lib.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1996,11 +1996,14 @@ impl Build {
19961996
cmd.push_cc_arg("-fdata-sections".into());
19971997
}
19981998
// Disable generation of PIC on bare-metal for now: rust-lld doesn't support this yet
1999-
if self.pic.unwrap_or(
2000-
!target.contains("windows")
2001-
&& !target.contains("-none-")
2002-
&& !target.ends_with("-none")
2003-
&& !target.contains("uefi"),
1999+
if self.pic.unwrap_or_else(
2000+
|| {
2001+
!target.contains("windows")
2002+
&& !target.contains("-none-")
2003+
&& !target.ends_with("-none")
2004+
&& !target.contains("uefi")
2005+
&& !Build::is_wasi_target(target)
2006+
}
20042007
) {
20052008
cmd.push_cc_arg("-fPIC".into());
20062009
// PLT only applies if code is compiled with PIC support,

0 commit comments

Comments
 (0)