Skip to content

Commit d0048ab

Browse files
authored
Don't pass -fPIC by default on wasm (#1245)
* Don't pass -fPIC by default on wasm Fix #1240 * Fix cargo fmt
1 parent 53a0b97 commit d0048ab

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1996,12 +1996,13 @@ 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(
1999+
if self.pic.unwrap_or_else(|| {
20002000
!target.contains("windows")
20012001
&& !target.contains("-none-")
20022002
&& !target.ends_with("-none")
2003-
&& !target.contains("uefi"),
2004-
) {
2003+
&& !target.contains("uefi")
2004+
&& !Build::is_wasi_target(target)
2005+
}) {
20052006
cmd.push_cc_arg("-fPIC".into());
20062007
// PLT only applies if code is compiled with PIC support,
20072008
// and only for ELF targets.

0 commit comments

Comments
 (0)