Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions compiler/rustc_target/src/spec/base/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ pub(crate) fn options() -> TargetOptions {
// with unwinding.
llvm_args: cvs!["-wasm-use-legacy-eh=false"],

// WASI's `sys::args::init` function ignores its arguments; instead,
// `args::args()` makes the WASI API calls itself.
//
// Other Wasm targets make no use of `std::env` entirely.
// Emscripten enables it explicitly.
main_needs_argc_argv: false,

..Default::default()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub(crate) fn target() -> Target {
crt_static_respected: true,
crt_static_default: true,
crt_static_allows_dylibs: true,
main_needs_argc_argv: true,
panic_strategy: PanicStrategy::Unwind,
no_default_libraries: false,
families: cvs!["unix", "wasm"],
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ pub(crate) fn target() -> Target {
// without a main function.
options.crt_static_allows_dylibs = true;

// WASI's `sys::args::init` function ignores its arguments; instead,
// `args::args()` makes the WASI API calls itself.
options.main_needs_argc_argv = false;

// And, WASI mangles the name of "main" to distinguish between different
// signatures.
options.entry_name = "__main_void".into();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ pub(crate) fn target() -> Target {
// without a main function.
options.crt_static_allows_dylibs = true;

// WASI's `sys::args::init` function ignores its arguments; instead,
// `args::args()` makes the WASI API calls itself.
options.main_needs_argc_argv = false;

// And, WASI mangles the name of "main" to distinguish between different
// signatures.
options.entry_name = "__main_void".into();
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ pub(crate) fn target() -> Target {
// without a main function.
options.crt_static_allows_dylibs = true;

// WASI's `sys::args::init` function ignores its arguments; instead,
// `args::args()` makes the WASI API calls itself.
options.main_needs_argc_argv = false;

// And, WASI mangles the name of "main" to distinguish between different
// signatures.
options.entry_name = "__main_void".into();
Expand Down
Loading