From cc36ffd13f6794cc5212a1f0ba7f58e816e8a0de Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 11 Jan 2022 13:29:10 -0800 Subject: [ctor-eval] Add an option to keep some exports (#4441) By default wasm-ctor-eval removes exports that it manages to completely eval (if it just partially evals then the export remains, but points to a function with partially-evalled contents). However, in some cases we do want to keep the export around even so, for example during fuzzing (as the fuzzer wants to call the same exports before and after wasm-ctor-eval runs) and also if there is an ABI we need to preserve (like if we manage to eval all of main()), or if the function returns a value (which we don't support yet, but this is a PR to prepare for that). Specifically, there is now a new option: --kept-exports foo,bar That is a list of exports to keep around. Note that when we keep around an export after evalling the ctor we make the export point to a new function. That new function just contains a nop, so that nothing happens when it is called. But the original function is kept around as it may have other callers, who we do not want to modify. --- test/lit/help/wasm-ctor-eval.test | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/lit/help') diff --git a/test/lit/help/wasm-ctor-eval.test b/test/lit/help/wasm-ctor-eval.test index 364ac5d4c..b3b577250 100644 --- a/test/lit/help/wasm-ctor-eval.test +++ b/test/lit/help/wasm-ctor-eval.test @@ -19,6 +19,10 @@ ;; CHECK-NEXT: --ctors,-c Comma-separated list of global ;; CHECK-NEXT: constructor functions to evaluate ;; CHECK-NEXT: +;; CHECK-NEXT: --kept-exports,-ke Comma-separated list of ctors whose +;; CHECK-NEXT: exports we keep around even if we eval +;; CHECK-NEXT: those ctors +;; CHECK-NEXT: ;; CHECK-NEXT: --ignore-external-input,-ipi Assumes no env vars are to be read, stdin ;; CHECK-NEXT: is empty, etc. ;; CHECK-NEXT: -- cgit v1.2.3