Skip to content

Commit

Permalink
Rollup merge of rust-lang#59712 - alexcrichton:wasm-static-not-pic, r…
Browse files Browse the repository at this point in the history
…=eddyb

wasm32: Default to a "static" relocation model

LLVM 9 is adding support for a "pic" relocation model for wasm code,
which is quite different than the current model. In order to preserve
the mode of compilation that we have today default to "static" to ensure
that we don't accidentally start creating experimental relocatable
binaries.
  • Loading branch information
Centril authored Apr 5, 2019
2 parents c0ed443 + 471db2b commit 7249036
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/librustc_target/spec/wasm32_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ pub fn options() -> TargetOptions {

pre_link_args,

// This has no effect in LLVM 8 or prior, but in LLVM 9 and later when
// PIC code is implemented this has quite a drastric effect if it stays
// at the default, `pic`. In an effort to keep wasm binaries as minimal
// as possible we're defaulting to `static` for now, but the hope is
// that eventually we can ship a `pic`-compatible standard library which
// works with `static` as well (or works with some method of generating
// non-relative calls and such later on).
relocation_model: "static".to_string(),

.. Default::default()
}
}

0 comments on commit 7249036

Please sign in to comment.