Disable main_needs_argc_argv for Wasm

This commit is contained in:
daxpedda
2026-05-14 14:45:33 +02:00
parent 1a70f8d36e
commit 1b7609cf1c
5 changed files with 8 additions and 12 deletions
@@ -118,6 +118,13 @@ macro_rules! args {
// 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()
}
}
@@ -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"],
@@ -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();
@@ -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();
@@ -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();