Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ See docs/process.md for more on how version tagging works.
- emcc will now treat `.bc` files as source files. These means that will get
compiled by clang before being passed to the linker. This matches the
behaviour of clang. (#20922)
- Emscripten now only supports browsers going back to certain versions. The
current set of minimum versions are: Chrome 32, Firefox 34, Safari 9.
Attempting to targets version older this using, for example
`MIN_CHROME_VERSION` will now result in build-time error. All of these
browser versions are at least 8 years old now so the hope is that nobody
is intending to target them today. (#20924)

3.1.51 - 12/13/23
-----------------
Expand Down
6 changes: 5 additions & 1 deletion src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,7 @@ var AUTO_NATIVE_LIBRARIES = true;
// for Firefox versions older than < majorVersion.
// Firefox 79 was released on 2020-07-28.
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
// Minimum supported value is 34 which was released on 2014-12-01.
// [link]
var MIN_FIREFOX_VERSION = 79;

Expand All @@ -1787,20 +1788,23 @@ var MIN_FIREFOX_VERSION = 79;
// older, i.e. iPhone 4s, iPad 2, iPad 3, iPad Mini 1, Pod Touch 5 and older,
// see https://github.com/emscripten-core/emscripten/pull/7191.
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
// Minimum supported value is 90000 which was released in 2015.
// [link]
var MIN_SAFARI_VERSION = 140100;

// Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=58 to
// drop support for Chrome 57 and older.
// Chrome 85 was released on 2020-08-25.
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
// Minimum supported value is 32, which was released on 2014-01-04.
// [link]
var MIN_CHROME_VERSION = 85;

// Specifies minimum node version to target for the generated code. This is
// distinct from the minimum version required run the emscripten compiler.
// This version aligns with the current Ubuuntu TLS 20.04 (Focal).
// Version is encoded in MMmmVV, e.g. 1814101 denotes Node 18.14.01.
// Version is encoded in MMmmVV, e.g. 181401 denotes Node 18.14.01.
// Minimum supported value is 101900, which was released 2020-02-05.
var MIN_NODE_VERSION = 160000;

// Tracks whether we are building with errno support enabled. Set to 0
Expand Down
6 changes: 5 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -13158,7 +13158,7 @@ def check_for_es6(filename, expect):
# to transpile.
print('with old browser')
self.emcc_args.remove('-Werror')
self.set_setting('MIN_CHROME_VERSION', '10')
self.set_setting('LEGACY_VM_SUPPORT')
self.do_runf('test.c', expected, output_basename='test_old')
check_for_es6('test_old.js', False)

Expand Down Expand Up @@ -14350,3 +14350,7 @@ def test_no_extra_output(self):
self.run_process([EMCC, '-c', test_file('hello_world.c')])
output = self.run_process([EMCC, '-c', test_file('hello_world.c')], stdout=PIPE, stderr=STDOUT).stdout
self.assertEqual(output, '')

def test_browser_too_old(self):
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMIN_CHROME_VERSION=10'])
self.assertContained('emcc: error: MIN_CHROME_VERSION older than 32 is not supported', err)
1 change: 1 addition & 0 deletions tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ def transpile(filename):
config_json = json.dumps(config, indent=2)
outfile = shared.get_temp_files().get('babel.js').name
config_file = shared.get_temp_files().get('babel_config.json').name
logger.debug(config_json)
utils.write_file(config_file, config_json)
cmd = shared.get_npm_cmd('babel') + [filename, '-o', outfile, '--presets', '@babel/preset-env', '--config-file', config_file]
check_call(cmd, cwd=path_from_root())
Expand Down
10 changes: 10 additions & 0 deletions tools/feature_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@

UNSUPPORTED = 0x7FFFFFFF

# Oldest support browser versions. These have been set somewhat
# arbitrarily for now.
# TODO(sbc): Design a of policy for managing these values.
OLDEST_SUPPORTED_CHROME = 32
OLDEST_SUPPORTED_FIREFOX = 34
OLDEST_SUPPORTED_SAFARI = 90000
# 10.19.0 is the oldest version of node that we do any testing with.
# Keep this in sync with the test-node-compat in .circleci/config.yml.
OLDEST_SUPPORTED_NODE = 101900


class Feature(IntEnum):
NON_TRAPPING_FPTOINT = auto()
Expand Down
45 changes: 27 additions & 18 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,26 @@ def set_max_memory():
exit_with_error('MAXIMUM_MEMORY cannot be less than INITIAL_MEMORY')


def check_browser_versions():
# Map of setting all VM version settings to the minimum version
# we support.
min_version_setttings = {
'MIN_FIREFOX_VERSION': feature_matrix.OLDEST_SUPPORTED_FIREFOX,
'MIN_CHROME_VERSION': feature_matrix.OLDEST_SUPPORTED_CHROME,
'MIN_SAFARI_VERSION': feature_matrix.OLDEST_SUPPORTED_SAFARI,
'MIN_NODE_VERSION': feature_matrix.OLDEST_SUPPORTED_NODE,
}

if settings.LEGACY_VM_SUPPORT:
# Default all browser versions to zero
for key in min_version_setttings.keys():
default_setting(key, 0)

for key, oldest in min_version_setttings.items():
if settings[key] != 0 and settings[key] < oldest:
exit_with_error(f'{key} older than {oldest} is not supported')


@ToolchainProfiler.profile_block('linker_setup')
def phase_linker_setup(options, state, newargs):
system_libpath = '-L' + str(cache.get_lib_dir(absolute=True))
Expand Down Expand Up @@ -1091,24 +1111,13 @@ def phase_linker_setup(options, state, newargs):
if settings.MINIMAL_RUNTIME and options.oformat == OFormat.HTML and not settings.PTHREADS:
settings.EXPORT_READY_PROMISE = 0

if settings.LEGACY_VM_SUPPORT:
if settings.WASM2JS:
settings.POLYFILL_OLD_MATH_FUNCTIONS = 1

# Support all old browser versions
settings.MIN_FIREFOX_VERSION = 0
settings.MIN_SAFARI_VERSION = 0
settings.MIN_CHROME_VERSION = 0
settings.MIN_NODE_VERSION = 0

# 10.19.0 is the oldest version of node that we do any testing with.
# Keep this in sync with the test-node-compat in .circleci/config.yml
# and MINIMUM_NODE_VERSION in tools/shared.py
if settings.MIN_NODE_VERSION:
if settings.MIN_NODE_VERSION < 101900:
exit_with_error('targeting node older than 10.19.00 is not supported')
if settings.MIN_NODE_VERSION >= 150000:
default_setting('NODEJS_CATCH_REJECTION', 0)
if settings.WASM2JS and settings.LEGACY_VM_SUPPORT:
settings.POLYFILL_OLD_MATH_FUNCTIONS = 1

check_browser_versions()

if settings.MIN_NODE_VERSION >= 150000:
default_setting('NODEJS_CATCH_REJECTION', 0)

# Do not catch rejections or exits in modularize mode, as these options
# are for use when running emscripten modules standalone
Expand Down