From 1f231c39e52eab712eda9bcbf540752b813b567d Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 24 Jul 2020 07:12:14 -0700 Subject: Wasm2c fuzz support: only emit a call to the hang limit function if present (#2977) It may not be present while reducing a testcase, if the reducer removed it. --- src/tools/wasm2c-wrapper.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tools/wasm2c-wrapper.h b/src/tools/wasm2c-wrapper.h index 55eed0c35..b3205c6fe 100644 --- a/src/tools/wasm2c-wrapper.h +++ b/src/tools/wasm2c-wrapper.h @@ -85,9 +85,14 @@ int main(int argc, char** argv) { // wasm traps, and emitting a single one helps compilation speed into wasm as // compile times are O(size * num_setjmps). for (size_t curr = 0;; curr++) { - // Always call the hang limit initializer before each export. + )"; + if (wasm.getExportOrNull("hangLimitInitializer")) { + ret += R"( + // If present, call the hang limit initializer before each export. (*Z_hangLimitInitializerZ_vv)(); - +)"; + } + ret += R"( // Prepare to call the export, so we can catch traps. if (WASM_RT_SETJMP(g_jmp_buf) != 0) { puts("exception!"); -- cgit v1.2.3