Skip to content

Commit

Permalink
Update default Safari version target to 15.0
Browse files Browse the repository at this point in the history
Update the default MIN_SAFARI_VERSION from 14.1 to 15.0.
Also fix the feature matrix code to be correct again as described in emscripten-core#23184
  • Loading branch information
dschuff committed Jan 6, 2025
1 parent 8f63761 commit e4df9dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ var MIN_FIREFOX_VERSION = 79;
// Minimum supported value is 101000 which was released in 2016-09 (see
// feature_matrix.py).
// [link]
var MIN_SAFARI_VERSION = 140100;
var MIN_SAFARI_VERSION = 150000;

// Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=58 to
// drop support for Chrome 57 and older.
Expand Down
3 changes: 1 addition & 2 deletions src/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ var Module = typeof {{{ EXPORT_NAME }}} != 'undefined' ? {{{ EXPORT_NAME }}} : {
#endif // USE_CLOSURE_COMPILER

#if POLYFILL
#if WASM_BIGINT && MIN_SAFARI_VERSION < 140100
// TODO(https://github.com/emscripten-core/emscripten/issues/23184): Fix this back to 150000
#if WASM_BIGINT && MIN_SAFARI_VERSION < 150000
// See https://caniuse.com/mdn-javascript_builtins_bigint64array
#include "polyfill/bigint64array.js"
#endif
Expand Down
32 changes: 15 additions & 17 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -10443,6 +10443,7 @@ def verify_features_sec_linked(feature, expect_in):
def compile(flags):
self.run_process([EMCC, test_file('hello_world.c')] + flags)

# Default features, unlinked and linked
compile(['-c'])
verify_features_sec('bulk-memory', True)
verify_features_sec('nontrapping-fptoint', True)
Expand All @@ -10451,17 +10452,28 @@ def compile(flags):
verify_features_sec('multivalue', True)
verify_features_sec('reference-types', True)

compile([])
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-opt', True)
verify_features_sec_linked('nontrapping-fptoint', True)
verify_features_sec_linked('reference-types', True)

# Disable a feature
compile(['-mno-sign-ext', '-c'])
verify_features_sec('sign-ext', False)
# Disable via browser selection
compile(['-sMIN_FIREFOX_VERSION=61'])
verify_features_sec_linked('sign-ext', False)
compile(['-sMIN_SAFARI_VERSION=140100'])
verify_features_sec_linked('bulk-memory-opt', False)
verify_features_sec_linked('nontrapping-fptoint', False)
# Flag disabling overrides default browser versions
compile(['-mno-sign-ext'])
verify_features_sec_linked('sign-ext', False)
# Flag disabling overrides explicit browser version
compile(['-sMIN_SAFARI_VERSION=150000', '-mno-sign-ext'])
compile(['-sMIN_SAFARI_VERSION=160000', '-mno-sign-ext'])
verify_features_sec_linked('sign-ext', False)
# Flag enabling overrides explicit browser version
compile(['-sMIN_FIREFOX_VERSION=61', '-msign-ext'])
Expand All @@ -10470,18 +10482,6 @@ def compile(flags):
compile(['-sMIN_SAFARI_VERSION=150000', '-mno-bulk-memory'])
verify_features_sec_linked('bulk-memory-opt', False)

# TODO(https://github.com/emscripten-core/emscripten/issues/23184) set this back to 14.1
# Also the section below can be deleted/updated once the default is 15.1
compile(['-sMIN_SAFARI_VERSION=140000'])
verify_features_sec_linked('bulk-memory-opt', False)
verify_features_sec_linked('nontrapping-fptoint', False)

compile(['-sMIN_SAFARI_VERSION=150000'])
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-opt', True)
verify_features_sec_linked('nontrapping-fptoint', True)

def test_js_preprocess(self):
# Use stderr rather than stdout here because stdout is redirected to the output JS file itself.
Expand Down Expand Up @@ -12360,8 +12360,7 @@ def fail(args, details):
# plain -O0
legalization_message = 'to disable int64 legalization (which requires changes after link) use -sWASM_BIGINT'
fail(['-sWASM_BIGINT=0'], legalization_message)
# TODO(https://github.com/emscripten-core/emscripten/issues/23184): change this back to 140100 after 15 is default
fail(['-sMIN_SAFARI_VERSION=140000'], legalization_message)
fail(['-sMIN_SAFARI_VERSION=140100'], legalization_message)
# optimized builds even without legalization
optimization_message = '-O2+ optimizations always require changes, build with -O0 or -O1 instead'
fail(['-O2'], optimization_message)
Expand Down Expand Up @@ -14435,8 +14434,7 @@ def test_reproduce(self):

def test_min_browser_version(self):
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-Wno-transpile', '-Werror', '-sWASM_BIGINT', '-sMIN_SAFARI_VERSION=120000'])
# TODO(https://github.com/emscripten-core/emscripten/issues/23184): fix back to 15000 once Safari 15 is default
self.assertContained('emcc: error: MIN_SAFARI_VERSION=120000 is not compatible with WASM_BIGINT (140100 or above required)', err)
self.assertContained('emcc: error: MIN_SAFARI_VERSION=120000 is not compatible with WASM_BIGINT (150000 or above required)', err)

err = self.expect_fail([EMCC, test_file('hello_world.c'), '-Wno-transpile', '-Werror', '-pthread', '-sMIN_CHROME_VERSION=73'])
self.assertContained('emcc: error: MIN_CHROME_VERSION=73 is not compatible with pthreads (74 or above required)', err)
Expand Down
6 changes: 3 additions & 3 deletions tools/feature_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Feature(IntEnum):
Feature.NON_TRAPPING_FPTOINT: {
'chrome': 75,
'firefox': 65,
'safari': 140100, # TODO: Reset back to 150000 when the default changes
'safari': 150000,
'node': 130000,
},
Feature.SIGN_EXT: {
Expand All @@ -58,7 +58,7 @@ class Feature(IntEnum):
Feature.BULK_MEMORY: {
'chrome': 75,
'firefox': 79,
'safari': 140100, # TODO: Reset this to 150000 when we update the default.
'safari': 150000,
'node': 130000,
},
Feature.MUTABLE_GLOBALS: {
Expand All @@ -70,7 +70,7 @@ class Feature(IntEnum):
Feature.JS_BIGINT_INTEGRATION: {
'chrome': 67,
'firefox': 68,
'safari': 140100, # TODO(https://github.com/emscripten-core/emscripten/issues/23184): set this back to 15 after we update the default targets.
'safari': 150000,
'node': 130000,
},
Feature.THREADS: {
Expand Down

0 comments on commit e4df9dc

Please sign in to comment.