Skip to content

Commit

Permalink
Don't pass -fPIC by default on wasm
Browse files Browse the repository at this point in the history
Fix #1240
  • Loading branch information
NobodyXu authored Oct 11, 2024
1 parent 53a0b97 commit c1f07fc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1996,11 +1996,14 @@ impl Build {
cmd.push_cc_arg("-fdata-sections".into());
}
// Disable generation of PIC on bare-metal for now: rust-lld doesn't support this yet
if self.pic.unwrap_or(
!target.contains("windows")
&& !target.contains("-none-")
&& !target.ends_with("-none")
&& !target.contains("uefi"),
if self.pic.unwrap_or_else(
|| {
!target.contains("windows")
&& !target.contains("-none-")
&& !target.ends_with("-none")
&& !target.contains("uefi")
&& !Build::is_wasi_target(target)
}
) {
cmd.push_cc_arg("-fPIC".into());
// PLT only applies if code is compiled with PIC support,
Expand Down

0 comments on commit c1f07fc

Please sign in to comment.