Stop passing -export-dynamic to wasm-ld.
-export-dynamic was a temporary hack added in the early days of the Rust wasm32 target when Rust didn't have a way to specify wasm exports in the source code. This flag causes all global symbols, and some compiler-internal symbols, to be exported, which is often more than needed. Rust now does have a way to specify exports in the source code: `#[export_name = "..."]`. So as the original comment suggests, -export-dynamic can now be removed, allowing users to have smaller binaries and better encapsulation in their wasm32-unknown-unknown modules. It's possible that this change will require existing wasm32-unknown-unknown users will to add explicit `#[export_name = "..."]` directives to exporrt the symbols that their programs depend on having exported.
This commit is contained in:
parent
53728ff751
commit
3a07aa9b5e
@ -33,12 +33,6 @@ pub fn target() -> Target {
|
|||||||
// For now this target just never has an entry symbol no matter the output
|
// For now this target just never has an entry symbol no matter the output
|
||||||
// type, so unconditionally pass this.
|
// type, so unconditionally pass this.
|
||||||
"--no-entry",
|
"--no-entry",
|
||||||
// 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.
|
|
||||||
"--export-dynamic",
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
options.add_pre_link_args(
|
options.add_pre_link_args(
|
||||||
@ -48,7 +42,6 @@ pub fn target() -> Target {
|
|||||||
// otherwise
|
// otherwise
|
||||||
"--target=wasm32-unknown-unknown",
|
"--target=wasm32-unknown-unknown",
|
||||||
"-Wl,--no-entry",
|
"-Wl,--no-entry",
|
||||||
"-Wl,--export-dynamic",
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user