From 7cc297213054e2d53f4f7b2032ba2bc6a4ace886 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Tue, 15 Oct 2024 17:38:36 -0700 Subject: [PATCH 1/9] Explicitly set bulk memory clang flag --- emcc.py | 10 +++++++++- tools/settings.py | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/emcc.py b/emcc.py index 52ee28c27547d..f4eb54153ed34 100644 --- a/emcc.py +++ b/emcc.py @@ -35,7 +35,7 @@ from subprocess import PIPE -from tools import shared, system_libs, utils, ports +from tools import shared, system_libs, utils, ports, feature_matrix from tools import colored_logger, diagnostics, building from tools.shared import unsuffixed, unsuffixed_basename, get_file_suffix from tools.shared import run_process, exit_with_error, DEBUG @@ -854,6 +854,14 @@ def phase_setup(options, state, newargs): if settings.SHARED_MEMORY: settings.BULK_MEMORY = 1 + if '-mbulk-memory' not in newargs and '-mno-bulk-memory' not in newargs: + print('newargs bulk') + if feature_matrix.caniuse(feature_matrix.Feature.BULK_MEMORY): + newargs += ['-mbulk-memory'] + settings.BULK_MEMORY = 1 + else: + newargs += ['-mno-bulk-memory'] + if 'DISABLE_EXCEPTION_CATCHING' in user_settings and 'EXCEPTION_CATCHING_ALLOWED' in user_settings: # If we get here then the user specified both DISABLE_EXCEPTION_CATCHING and EXCEPTION_CATCHING_ALLOWED # on the command line. This is no longer valid so report either an error or a warning (for diff --git a/tools/settings.py b/tools/settings.py index fc884b3046deb..f402f80473998 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -96,6 +96,10 @@ 'WASM_OBJECT_FILES', 'WASM_WORKERS', 'BULK_MEMORY', + 'MIN_SAFARI_VERSION', + 'MIN_CHROME_VERSION', + 'MIN_FIREFOX_VERSION', + 'MIN_NODE_VERSION', # Internal settings used during compilation 'EXCEPTION_CATCHING_ALLOWED', From 4ca45b27bd495d17124c91cddfc6f6a9067e8a48 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 16 Oct 2024 09:41:21 -0700 Subject: [PATCH 2/9] remove print, add nontrapping-fptoint --- emcc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emcc.py b/emcc.py index f4eb54153ed34..ccfe0b3b29259 100644 --- a/emcc.py +++ b/emcc.py @@ -855,12 +855,16 @@ def phase_setup(options, state, newargs): settings.BULK_MEMORY = 1 if '-mbulk-memory' not in newargs and '-mno-bulk-memory' not in newargs: - print('newargs bulk') if feature_matrix.caniuse(feature_matrix.Feature.BULK_MEMORY): newargs += ['-mbulk-memory'] settings.BULK_MEMORY = 1 else: newargs += ['-mno-bulk-memory'] + if '-mnontrapping-fptoint' not in newargs and '-mno-nontrapping-fptoint' not in newargs: + if feature_matrix.caniuse(feature_matrix.Feature.NON_TRAPPING_FPTOINT): + newargs += ['-mnontrapping-fptoint'] + else: + newargs += ['-mno-nontrapping-fptoint'] if 'DISABLE_EXCEPTION_CATCHING' in user_settings and 'EXCEPTION_CATCHING_ALLOWED' in user_settings: # If we get here then the user specified both DISABLE_EXCEPTION_CATCHING and EXCEPTION_CATCHING_ALLOWED From 5b956b41a932ce04fb7c189efc7e8b845a01b669 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 16 Oct 2024 16:43:37 -0700 Subject: [PATCH 3/9] add test --- test/test_other.py | 24 ++++++++++++++++++++++++ tools/webassembly.py | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/test/test_other.py b/test/test_other.py index 61e13c20c037b..56351fd169b1f 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -10268,6 +10268,30 @@ def test_wasm_features_section(self, args): self.run_process([EMCC, test_file('hello_world.c'), '-O2'] + args) self.verify_custom_sec_existence('a.out.wasm', 'target_features', False) + def test_wasm_features(self): + # Test that wasm features are explicitly enabled or disabled based on target engine version + def verify_features_sec(feature, expect_in): + with webassembly.Module('hello_world.o') as module: + features = module.get_target_features() + if expect_in: + self.assertTrue(feature in features and features[feature] == webassembly.TargetFeaturePrefix.USED) + else: + self.assertFalse(feature in features) + + def compile(flag): + self.run_process([EMCC, test_file('hello_world.c'), '-c', flag]) + + compile('') + verify_features_sec('bulk-memory', False) + verify_features_sec('nontrapping-fptoint', False) + verify_features_sec('sign-ext', True) + verify_features_sec('mutable-globals', True) + verify_features_sec('multivalue', True) + + compile('-sMIN_SAFARI_VERSION=150000') + verify_features_sec('bulk-memory', True) + verify_features_sec('nontrapping-fptoint', True) + def test_js_preprocess(self): # Use stderr rather than stdout here because stdout is redirected to the output JS file itself. create_file('lib.js', ''' diff --git a/tools/webassembly.py b/tools/webassembly.py index 69376b989ed4b..7febe5a335d7f 100644 --- a/tools/webassembly.py +++ b/tools/webassembly.py @@ -162,6 +162,12 @@ class DylinkType(IntEnum): IMPORT_INFO = 4 +class TargetFeaturePrefix(IntEnum): + USED = 0x2b + DISALLOWED = 0x2d + REQUIRED = 0x3d + + class InvalidWasmError(BaseException): pass @@ -561,6 +567,18 @@ def get_function_type(self, idx): func_type = self.get_function_types()[idx - self.num_imported_funcs()] return self.get_types()[func_type] + def get_target_features(self): + section = self.get_custom_section('target_features') + self.seek(section.offset) + assert self.read_string() == 'target_features' + features = {} + feature_count = self.read_byte() + while self.tell() < section.offset + section.size: + prefix = TargetFeaturePrefix(self.read_byte()) + feature = self.read_string() + features[feature] = prefix + return features + def parse_dylink_section(wasm_file): with Module(wasm_file) as module: From 6ed1380587510914fd3ed3a3cd2179c589e34686 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 16 Oct 2024 16:50:00 -0700 Subject: [PATCH 4/9] more tests --- test/test_other.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/test_other.py b/test/test_other.py index 56351fd169b1f..0bf1ffab21ef2 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -10278,20 +10278,30 @@ def verify_features_sec(feature, expect_in): else: self.assertFalse(feature in features) - def compile(flag): - self.run_process([EMCC, test_file('hello_world.c'), '-c', flag]) + def compile(flags): + self.run_process([EMCC, test_file('hello_world.c'), '-c'] + flags) - compile('') + compile([]) verify_features_sec('bulk-memory', False) verify_features_sec('nontrapping-fptoint', False) verify_features_sec('sign-ext', True) verify_features_sec('mutable-globals', True) verify_features_sec('multivalue', True) + verify_features_sec('reference-types', True) - compile('-sMIN_SAFARI_VERSION=150000') + compile(['-mnontrapping-fptoint']) + verify_features_sec('nontrapping-fptoint', True) + + compile(['-sMIN_SAFARI_VERSION=150000']) + verify_features_sec('sign-ext', True) + verify_features_sec('mutable-globals', True) + verify_features_sec('multivalue', True) verify_features_sec('bulk-memory', True) verify_features_sec('nontrapping-fptoint', True) + compile(['-sMIN_SAFARI_VERSION=150000', '-mno-bulk-memory']) + verify_features_sec('bulk-memory', False) + def test_js_preprocess(self): # Use stderr rather than stdout here because stdout is redirected to the output JS file itself. create_file('lib.js', ''' From 5c5da1040cc780be338ad21abd685994fdfb9821 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Mon, 21 Oct 2024 10:07:41 -0700 Subject: [PATCH 5/9] comment --- tools/webassembly.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/webassembly.py b/tools/webassembly.py index 7febe5a335d7f..f8c9a3be38841 100644 --- a/tools/webassembly.py +++ b/tools/webassembly.py @@ -572,7 +572,7 @@ def get_target_features(self): self.seek(section.offset) assert self.read_string() == 'target_features' features = {} - feature_count = self.read_byte() + self.read_byte() # ignore feature count while self.tell() < section.offset + section.size: prefix = TargetFeaturePrefix(self.read_byte()) feature = self.read_string() From 9257c5bcf929acad17a928e8b0091a2886813404 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 24 Oct 2024 09:35:22 -0700 Subject: [PATCH 6/9] default to safari 15, fix up some tests --- test/test_core.py | 2 +- test/test_other.py | 4 ++-- tools/feature_matrix.py | 2 +- tools/maybe_wasm2js.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_core.py b/test/test_core.py index f6b746780beb3..a53c6b2d9e310 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -4625,7 +4625,7 @@ def test_dylink_postsets_chunking(self): @with_dylink_reversed @parameterized({ - 'libcxx': ('libc,libc++,libmalloc,libc++abi',), + 'libcxx': ('libc,libc++,libmalloc,libc++abi,libbulkmemory',), 'all': ('1',), 'missing': ('libc,libmalloc,libc++abi', False, False, False), 'missing_assertions': ('libc,libmalloc,libc++abi', False, False, True), diff --git a/test/test_other.py b/test/test_other.py index 0bf1ffab21ef2..94516365ee2a2 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -8370,7 +8370,7 @@ def test_binaryen_warn_mem(self): self.run_process([EMCC, test_file('hello_world.c'), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY']) out = self.run_js('a.out.js', assert_returncode=NON_ZERO) self.assertContained('LinkError', out) - self.assertContained("memory import 2 has a larger maximum size 800 than the module's declared maximum", out) + self.assertContained("memory import 1 has a larger maximum size 800 than the module's declared maximum", out) self.assertNotContained('hello, world!', out) # and with memory growth, all should be good self.run_process([EMCC, test_file('hello_world.c'), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sALLOW_MEMORY_GROWTH', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY']) @@ -12850,7 +12850,7 @@ def test_split_module(self, customLoader, jspi): self.assertExists('profile.data') wasm_split = os.path.join(building.get_binaryen_bin(), 'wasm-split') - wasm_split_run = [wasm_split, '-g', '--enable-mutable-globals', '--export-prefix=%', 'test_split_module.wasm.orig', '-o1', 'primary.wasm', '-o2', 'secondary.wasm', '--profile=profile.data'] + wasm_split_run = [wasm_split, '-g', '--enable-mutable-globals', '--enable-bulk-memory', '--export-prefix=%', 'test_split_module.wasm.orig', '-o1', 'primary.wasm', '-o2', 'secondary.wasm', '--profile=profile.data'] if jspi: wasm_split_run += ['--jspi', '--enable-reference-types'] self.run_process(wasm_split_run) diff --git a/tools/feature_matrix.py b/tools/feature_matrix.py index 0b6a26368e99e..386e3a393f1ec 100644 --- a/tools/feature_matrix.py +++ b/tools/feature_matrix.py @@ -54,7 +54,7 @@ class Feature(IntEnum): Feature.BULK_MEMORY: { 'chrome': 75, 'firefox': 79, - 'safari': 150000, + 'safari': 140000, }, Feature.MUTABLE_GLOBALS: { 'chrome': 74, diff --git a/tools/maybe_wasm2js.py b/tools/maybe_wasm2js.py index 6b90ef8f70094..037a14fae08b2 100755 --- a/tools/maybe_wasm2js.py +++ b/tools/maybe_wasm2js.py @@ -41,7 +41,7 @@ # main -cmd = [os.path.join(building.get_binaryen_bin(), 'wasm2js'), '--emscripten', wasm_file] +cmd = [os.path.join(building.get_binaryen_bin(), 'wasm2js'), '--emscripten', '--enable-bulk-memory', wasm_file] cmd += opts js = shared.run_process(cmd, stdout=subprocess.PIPE).stdout # assign the instantiate function to where it will be used From dfb9e50248c968a4f411fca59707f405c60574a7 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 24 Oct 2024 16:24:28 -0700 Subject: [PATCH 7/9] prepare for landing before feature update --- emcc.py | 20 +++++++------------- test/test_core.py | 2 +- test/test_other.py | 42 ++++++++++++++++++++++++----------------- tools/feature_matrix.py | 2 +- tools/maybe_wasm2js.py | 2 +- tools/settings.py | 4 ---- 6 files changed, 35 insertions(+), 37 deletions(-) diff --git a/emcc.py b/emcc.py index ccfe0b3b29259..be49db9c98fcb 100644 --- a/emcc.py +++ b/emcc.py @@ -35,7 +35,7 @@ from subprocess import PIPE -from tools import shared, system_libs, utils, ports, feature_matrix +from tools import shared, system_libs, utils, ports from tools import colored_logger, diagnostics, building from tools.shared import unsuffixed, unsuffixed_basename, get_file_suffix from tools.shared import run_process, exit_with_error, DEBUG @@ -383,6 +383,12 @@ def get_clang_flags(user_args): flags.append('-matomics') if '-mbulk-memory' not in user_args: flags.append('-mbulk-memory') + elif '-mbulk-memory' not in user_args and '-mno-bulk-memory' not in user_args: + # Bulk memory may be enabled via threads or directly via -s. + if not settings.BULK_MEMORY: + flags.append('-mno-bulk-memory') + if '-mnontrapping-fptoint' not in user_args and '-mno-nontrapping-fptoint' not in user_args: + flags.append('-mno-nontrapping-fptoint') if settings.RELOCATABLE and '-fPIC' not in user_args: flags.append('-fPIC') @@ -854,18 +860,6 @@ def phase_setup(options, state, newargs): if settings.SHARED_MEMORY: settings.BULK_MEMORY = 1 - if '-mbulk-memory' not in newargs and '-mno-bulk-memory' not in newargs: - if feature_matrix.caniuse(feature_matrix.Feature.BULK_MEMORY): - newargs += ['-mbulk-memory'] - settings.BULK_MEMORY = 1 - else: - newargs += ['-mno-bulk-memory'] - if '-mnontrapping-fptoint' not in newargs and '-mno-nontrapping-fptoint' not in newargs: - if feature_matrix.caniuse(feature_matrix.Feature.NON_TRAPPING_FPTOINT): - newargs += ['-mnontrapping-fptoint'] - else: - newargs += ['-mno-nontrapping-fptoint'] - if 'DISABLE_EXCEPTION_CATCHING' in user_settings and 'EXCEPTION_CATCHING_ALLOWED' in user_settings: # If we get here then the user specified both DISABLE_EXCEPTION_CATCHING and EXCEPTION_CATCHING_ALLOWED # on the command line. This is no longer valid so report either an error or a warning (for diff --git a/test/test_core.py b/test/test_core.py index a53c6b2d9e310..f6b746780beb3 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -4625,7 +4625,7 @@ def test_dylink_postsets_chunking(self): @with_dylink_reversed @parameterized({ - 'libcxx': ('libc,libc++,libmalloc,libc++abi,libbulkmemory',), + 'libcxx': ('libc,libc++,libmalloc,libc++abi',), 'all': ('1',), 'missing': ('libc,libmalloc,libc++abi', False, False, False), 'missing_assertions': ('libc,libmalloc,libc++abi', False, False, True), diff --git a/test/test_other.py b/test/test_other.py index 94516365ee2a2..0b8484173c604 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -8370,7 +8370,7 @@ def test_binaryen_warn_mem(self): self.run_process([EMCC, test_file('hello_world.c'), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY']) out = self.run_js('a.out.js', assert_returncode=NON_ZERO) self.assertContained('LinkError', out) - self.assertContained("memory import 1 has a larger maximum size 800 than the module's declared maximum", out) + self.assertContained("memory import 2 has a larger maximum size 800 than the module's declared maximum", out) self.assertNotContained('hello, world!', out) # and with memory growth, all should be good self.run_process([EMCC, test_file('hello_world.c'), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sALLOW_MEMORY_GROWTH', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY']) @@ -10270,18 +10270,24 @@ def test_wasm_features_section(self, args): def test_wasm_features(self): # Test that wasm features are explicitly enabled or disabled based on target engine version - def verify_features_sec(feature, expect_in): - with webassembly.Module('hello_world.o') as module: + def verify_features_sec(feature, expect_in, linked=False): + with webassembly.Module('a.out.wasm' if linked else 'hello_world.o') as module: features = module.get_target_features() if expect_in: - self.assertTrue(feature in features and features[feature] == webassembly.TargetFeaturePrefix.USED) + self.assertTrue(feature in features and + features[feature] == webassembly.TargetFeaturePrefix.USED, + f'{feature} missing from wasm file') else: - self.assertFalse(feature in features) + self.assertFalse(feature in features, + f'{feature} unexpectedly found in wasm file') + + def verify_features_sec_linked(feature, expect_in): + return verify_features_sec(feature, expect_in, linked=True) def compile(flags): - self.run_process([EMCC, test_file('hello_world.c'), '-c'] + flags) + self.run_process([EMCC, test_file('hello_world.c')] + flags) - compile([]) + compile(['-c']) verify_features_sec('bulk-memory', False) verify_features_sec('nontrapping-fptoint', False) verify_features_sec('sign-ext', True) @@ -10289,18 +10295,20 @@ def compile(flags): verify_features_sec('multivalue', True) verify_features_sec('reference-types', True) - compile(['-mnontrapping-fptoint']) + compile(['-mnontrapping-fptoint', '-c']) verify_features_sec('nontrapping-fptoint', True) - compile(['-sMIN_SAFARI_VERSION=150000']) - verify_features_sec('sign-ext', True) - verify_features_sec('mutable-globals', True) - verify_features_sec('multivalue', True) - verify_features_sec('bulk-memory', True) - verify_features_sec('nontrapping-fptoint', True) + # BIGINT causes binaryen to not run, and keeps the target_features section + compile(['-sMIN_SAFARI_VERSION=150000', '-sWASM_BIGINT']) + verify_features_sec_linked('sign-ext', True) + verify_features_sec_linked('mutable-globals', True) + verify_features_sec_linked('multivalue', True) + verify_features_sec_linked('bulk-memory', True) + verify_features_sec_linked('nontrapping-fptoint', False) - compile(['-sMIN_SAFARI_VERSION=150000', '-mno-bulk-memory']) - verify_features_sec('bulk-memory', False) + compile(['-sMIN_SAFARI_VERSION=150000', '-mno-bulk-memory', '-sWASM_BIGINT']) + # FIXME? -mno-bulk-memory at link time does not override MIN_SAFARI_VERSION. it probably should? + verify_features_sec_linked('bulk-memory', True) def test_js_preprocess(self): # Use stderr rather than stdout here because stdout is redirected to the output JS file itself. @@ -12850,7 +12858,7 @@ def test_split_module(self, customLoader, jspi): self.assertExists('profile.data') wasm_split = os.path.join(building.get_binaryen_bin(), 'wasm-split') - wasm_split_run = [wasm_split, '-g', '--enable-mutable-globals', '--enable-bulk-memory', '--export-prefix=%', 'test_split_module.wasm.orig', '-o1', 'primary.wasm', '-o2', 'secondary.wasm', '--profile=profile.data'] + wasm_split_run = [wasm_split, '-g', '--enable-mutable-globals', '--export-prefix=%', 'test_split_module.wasm.orig', '-o1', 'primary.wasm', '-o2', 'secondary.wasm', '--profile=profile.data'] if jspi: wasm_split_run += ['--jspi', '--enable-reference-types'] self.run_process(wasm_split_run) diff --git a/tools/feature_matrix.py b/tools/feature_matrix.py index 386e3a393f1ec..0b6a26368e99e 100644 --- a/tools/feature_matrix.py +++ b/tools/feature_matrix.py @@ -54,7 +54,7 @@ class Feature(IntEnum): Feature.BULK_MEMORY: { 'chrome': 75, 'firefox': 79, - 'safari': 140000, + 'safari': 150000, }, Feature.MUTABLE_GLOBALS: { 'chrome': 74, diff --git a/tools/maybe_wasm2js.py b/tools/maybe_wasm2js.py index 037a14fae08b2..6b90ef8f70094 100755 --- a/tools/maybe_wasm2js.py +++ b/tools/maybe_wasm2js.py @@ -41,7 +41,7 @@ # main -cmd = [os.path.join(building.get_binaryen_bin(), 'wasm2js'), '--emscripten', '--enable-bulk-memory', wasm_file] +cmd = [os.path.join(building.get_binaryen_bin(), 'wasm2js'), '--emscripten', wasm_file] cmd += opts js = shared.run_process(cmd, stdout=subprocess.PIPE).stdout # assign the instantiate function to where it will be used diff --git a/tools/settings.py b/tools/settings.py index f402f80473998..fc884b3046deb 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -96,10 +96,6 @@ 'WASM_OBJECT_FILES', 'WASM_WORKERS', 'BULK_MEMORY', - 'MIN_SAFARI_VERSION', - 'MIN_CHROME_VERSION', - 'MIN_FIREFOX_VERSION', - 'MIN_NODE_VERSION', # Internal settings used during compilation 'EXCEPTION_CATCHING_ALLOWED', From 8ef0ed776f8d88cfcb3d2c3f695c7991a8d35d35 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 24 Oct 2024 16:31:16 -0700 Subject: [PATCH 8/9] add comment --- test/test_other.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/test_other.py b/test/test_other.py index 0b8484173c604..22802283c84d3 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -10298,7 +10298,10 @@ def compile(flags): compile(['-mnontrapping-fptoint', '-c']) verify_features_sec('nontrapping-fptoint', True) - # BIGINT causes binaryen to not run, and keeps the target_features section + # BIGINT causes binaryen to not run, and keeps the target_features section after link + # Setting this SAFARI_VERSION should enable bulk memory because it links in emscripten_memcpy_bulkmem + # However it does not enable nontrapping-fptoint yet because it has no effect at compile time and + # no libraries include nontrapping yet. compile(['-sMIN_SAFARI_VERSION=150000', '-sWASM_BIGINT']) verify_features_sec_linked('sign-ext', True) verify_features_sec_linked('mutable-globals', True) From 457504290478c7784307cfbeea5b812acca86430 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 24 Oct 2024 17:16:52 -0700 Subject: [PATCH 9/9] review comments --- emcc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emcc.py b/emcc.py index be49db9c98fcb..fcaf2b91e3ad2 100644 --- a/emcc.py +++ b/emcc.py @@ -383,12 +383,15 @@ def get_clang_flags(user_args): flags.append('-matomics') if '-mbulk-memory' not in user_args: flags.append('-mbulk-memory') - elif '-mbulk-memory' not in user_args and '-mno-bulk-memory' not in user_args: + + # In emscripten we currently disable bulk memory by default. + # This should be removed/updated when we als update the default browser targets. + if '-mbulk-memory' not in user_args and '-mno-bulk-memory' not in user_args: # Bulk memory may be enabled via threads or directly via -s. if not settings.BULK_MEMORY: flags.append('-mno-bulk-memory') if '-mnontrapping-fptoint' not in user_args and '-mno-nontrapping-fptoint' not in user_args: - flags.append('-mno-nontrapping-fptoint') + flags.append('-mno-nontrapping-fptoint') if settings.RELOCATABLE and '-fPIC' not in user_args: flags.append('-fPIC')