From 89f26c94796204cbd8c3d7e1fb9be659aa7b9081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 2 Dec 2019 14:10:46 +0100 Subject: [PATCH] Emscripten: Re-add BINARYEN_TRAP_MODE='clamp' for fastcomp The option is needed when using the 'fastcomp' backend (default before 1.39.0), and must not be defined when using 'upstream' (new default). So we define it conditionally to support both backends. Follow-up to #30751. (cherry picked from commit 6d6280dfa3a470a08287f294bb78bc9ea08ef0b0) --- platform/javascript/detect.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index d0a198e2b5e..7484217516d 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -125,6 +125,13 @@ def configure(env): env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) + # This needs to be defined for Emscripten using 'fastcomp' (default pre-1.39.0) + # and undefined if using 'upstream'. And to make things simple, earlier + # Emscripten versions didn't include 'fastcomp' in their path, so we check + # against the presence of 'upstream' to conditionally add the flag. + if not "upstream" in em_config['EMSCRIPTEN_ROOT']: + env.Append(LINKFLAGS=['-s', 'BINARYEN_TRAP_MODE=\'clamp\'']) + # Allow increasing memory buffer size during runtime. This is efficient # when using WebAssembly (in comparison to asm.js) and works well for # us since we don't know requirements at compile-time.