diff options
author | Alon Zakai <azakai@google.com> | 2022-01-12 13:17:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 21:17:50 +0000 |
commit | 29604f1a7e9ef9dcc2825f076849cd6a452a8a19 (patch) | |
tree | c4d8b432f10c675122463342ecd89280468ff8c5 /test/ctor-eval/ignore-external-input.wast.out | |
parent | 10b1ad720d5f5c991cd7049f8650011d89869f60 (diff) | |
download | binaryen-29604f1a7e9ef9dcc2825f076849cd6a452a8a19.tar.gz binaryen-29604f1a7e9ef9dcc2825f076849cd6a452a8a19.tar.bz2 binaryen-29604f1a7e9ef9dcc2825f076849cd6a452a8a19.zip |
[ctor-eval] Eval functions with params if ignoring external input (#4446)
When ignoring external input, assume params have a value of 0. This
makes it possible to eval main(argc, argv) if one is careful and does
not actually use those values.
This is basically a workaround for main always receiving argc/argv,
even if the C code has no args (in that case the compiler emits
__original_main for the user's main, and wraps it with a main
that adds the args, hence the problem).
This is similar to the existing support for handling wasi_args_get
when ignoring external input, although it just sets values of zeros for
the params. Perhaps it could check for main() specifically and return
1 for argc and a proper buffer for argv somehow, but I think if a program
wants to use --ignore-external-input it can avoid actually reading
argc/argv.
Diffstat (limited to 'test/ctor-eval/ignore-external-input.wast.out')
-rw-r--r-- | test/ctor-eval/ignore-external-input.wast.out | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/ctor-eval/ignore-external-input.wast.out b/test/ctor-eval/ignore-external-input.wast.out index f728afd0e..d61f2e6b9 100644 --- a/test/ctor-eval/ignore-external-input.wast.out +++ b/test/ctor-eval/ignore-external-input.wast.out @@ -3,14 +3,14 @@ (type $none_=>_none (func)) (import "wasi_snapshot_preview1" "something_else" (func $wasi_something_else (result i32))) (memory $0 256 256) - (data (i32.const 24) "aaaa") - (export "test3" (func $2)) - (func $2 + (data (i32.const 28) "aaaa") + (export "test3" (func $3)) + (func $3 (drop (call $wasi_something_else) ) (i32.store - (i32.const 24) + (i32.const 28) (i32.const 100) ) ) |