Don't link with --export-dynamic on wasm32-wasi
Remove --export-dynamic from the link arguments on the wasm32-wasi target, as it emits spurious exports and increases code size. Leave it in place for wasm32-unknown-unknown and wasm32-unknown-emscripten. Even though it isn't a great solution there, users are likely depending on its behavior there.
This commit is contained in:
@@ -2,6 +2,17 @@ use super::wasm32_base;
|
||||
use super::{LinkArgs, LinkerFlavor, PanicStrategy, Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut options = wasm32_base::options();
|
||||
|
||||
let clang_args = options.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap();
|
||||
|
||||
// Rust really needs a way for users to specify exports and imports in
|
||||
// the source code. --export-dynamic isn't the right tool for this job,
|
||||
// however it does have the side effect of automatically exporting a lot
|
||||
// of symbols, which approximates what people want when compiling for
|
||||
// wasm32-unknown-unknown expect, so use it for now.
|
||||
clang_args.push("--export-dynamic".to_string());
|
||||
|
||||
let mut post_link_args = LinkArgs::new();
|
||||
post_link_args.insert(
|
||||
LinkerFlavor::Em,
|
||||
@@ -28,7 +39,7 @@ pub fn target() -> Target {
|
||||
panic_strategy: PanicStrategy::Unwind,
|
||||
post_link_args,
|
||||
os_family: Some("unix".to_string()),
|
||||
..wasm32_base::options()
|
||||
..options
|
||||
};
|
||||
Target {
|
||||
llvm_target: "wasm32-unknown-emscripten".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user