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 @@ -26,6 +26,12 @@ See docs/process.md for more on how version tagging works.
using `-gsource-map=inline`. (#23741)
- The python `__file__` builtin now works in the emscripten config file.
(#23973)
- Three deprecated settings were removed. These settings were marked as
deprecated for more than year:
- SUPPORT_ERRNO: Instead, export `__errno_location` if needed.
- EXTRA_EXPORTED_RUNTIME_METHODS: Instead use EXPORTED_RUNTIME_METHODS.
- DEMANGLE_SUPPORT: Instead use the `$demangle` JS libary function.
(#23975)

4.0.5 - 03/12/25
----------------
Expand Down
34 changes: 0 additions & 34 deletions site/source/docs/tools_reference/settings_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -482,17 +482,6 @@ Print out exceptions in emscriptened code.

Default value: false

.. _demangle_support:

DEMANGLE_SUPPORT
================

If 1, export `demangle` and `stackTrace` JS library functions.

.. note:: This setting is deprecated

Default value: false

.. _library_debug:

LIBRARY_DEBUG
Expand Down Expand Up @@ -1442,17 +1431,6 @@ having "FS" in this list.

Default value: []

.. _extra_exported_runtime_methods:

EXTRA_EXPORTED_RUNTIME_METHODS
==============================

Deprecated, use EXPORTED_RUNTIME_METHODS instead.

.. note:: This setting is deprecated

Default value: []

.. _incoming_module_js_api:

INCOMING_MODULE_JS_API
Expand Down Expand Up @@ -2951,18 +2929,6 @@ feature_matrix.py).

Default value: 160000

.. _support_errno:

SUPPORT_ERRNO
=============

Whether we support setting errno from JS library code.
In MINIMAL_RUNTIME builds, this option defaults to 0.

.. note:: This setting is deprecated

Default value: true

.. _minimal_runtime:

MINIMAL_RUNTIME
Expand Down
15 changes: 0 additions & 15 deletions src/lib/liblegacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,6 @@ legacyFuncs = {
$allocateUTF8: '$stringToNewUTF8',
$allocateUTF8OnStack: '$stringToUTF8OnStack',

#if SUPPORT_ERRNO
$setErrNo__deps: ['__errno_location'],
$setErrNo: (value) => {
{{{makeSetValue("___errno_location()", 0, 'value', 'i32') }}};
return value;
},
#else
$setErrNo: (value) => {
#if ASSERTIONS
err('failed to set errno from JS');
#endif
return 0;
},
#endif

#if LINK_AS_CXX
$demangle__deps: ['$withStackSave', '__cxa_demangle', 'free', '$stringToUTF8OnStack'],
$demangle: (func) => {
Expand Down
18 changes: 3 additions & 15 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,6 @@ var EMULATE_FUNCTION_POINTER_CASTS = false;
// [link]
var EXCEPTION_DEBUG = false;

// If 1, export `demangle` and `stackTrace` JS library functions.
// [link]
// [deprecated]
var DEMANGLE_SUPPORT = false;

// Print out when we enter a library call (library*.js). You can also unset
// runtimeDebug at runtime for logging to cease, and can set it when you want
// it back. A simple way to set it in C++ is::
Expand Down Expand Up @@ -970,10 +965,6 @@ var JSPI_IMPORTS = [];
// [link]
var EXPORTED_RUNTIME_METHODS = [];

// Deprecated, use EXPORTED_RUNTIME_METHODS instead.
// [deprecated]
var EXTRA_EXPORTED_RUNTIME_METHODS = [];

// A list of incoming values on the Module object in JS that we care about. If
// a value is not in this list, then we don't emit code to check if you provide
// it on the Module object. For example, if
Expand Down Expand Up @@ -1928,12 +1919,6 @@ var MIN_CHROME_VERSION = 85;
// feature_matrix.py).
var MIN_NODE_VERSION = 160000;

// Whether we support setting errno from JS library code.
// In MINIMAL_RUNTIME builds, this option defaults to 0.
// [link]
// [deprecated]
var SUPPORT_ERRNO = true;

// If true, uses minimal sized runtime without POSIX features, Module,
// preRun/preInit/etc., Emscripten built-in XHR loading or library_browser.js.
// Enable this setting to target the smallest code size possible. Set
Expand Down Expand Up @@ -2285,4 +2270,7 @@ var LEGACY_SETTINGS = [
['WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG', [0], 'No longer supported'],
['AUTO_ARCHIVE_INDEXES', [0, 1], 'No longer needed'],
['USE_ES6_IMPORT_META', [1], 'Disabling is no longer supported'],
['EXTRA_EXPORTED_RUNTIME_METHODS', [[]], 'No longer supported, use EXPORTED_RUNTIME_METHODS'],
['SUPPORT_ERRNO', [0], 'No longer supported'],
['DEMANGLE_SUPPORT', [0], 'No longer supported'],
];
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_mangle.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9244
9277
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_mangle.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23720
23834
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7984
7977
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21327
21318
21 changes: 0 additions & 21 deletions test/other/test_support_errno.c

This file was deleted.

2 changes: 0 additions & 2 deletions test/other/test_support_errno.out

This file was deleted.

3 changes: 0 additions & 3 deletions test/other/test_support_errno_disabled.out

This file was deleted.

2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
52673
52659
40 changes: 7 additions & 33 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -3958,6 +3958,8 @@ def test_demangle(self):
#include <stdio.h>
#include <emscripten.h>

EM_JS_DEPS(deps, "$demangle,$stackTrace");

void two(char c) {
EM_ASM(out(stackTrace()));
}
Expand Down Expand Up @@ -3989,7 +3991,7 @@ def test_demangle(self):

# full demangle support

self.run_process([EMXX, 'src.cpp', '-sDEMANGLE_SUPPORT'])
self.run_process([EMXX, 'src.cpp', '-sEXPORTED_FUNCTIONS=_main,_free,___cxa_demangle'])
output = self.run_js('a.out.js')
self.assertContained('''operator new(unsigned long)
_main
Expand All @@ -4010,7 +4012,7 @@ def test_demangle(self):
void wakaw::Cm::RasterBase<wakaw::watwat::Polocator>::merbine1<wakaw::Cm::RasterBase<wakaw::watwat::Polocator>::OR>(unsigned int const*, unsigned int)
''', output)
# test for multiple functions in one stack trace
self.run_process([EMXX, 'src.cpp', '-sDEMANGLE_SUPPORT', '-g'])
self.run_process([EMXX, 'src.cpp', '-sEXPORTED_FUNCTIONS=_main,_free,___cxa_demangle', '-g'])
output = self.run_js('a.out.js')
self.assertIn('one(int)', output)
self.assertIn('two(char)', output)
Expand Down Expand Up @@ -9184,7 +9186,7 @@ def test_codesize_minimal_pthreads(self):
'except': (['-O2', '-fexceptions'], [], ['waka']), # noqa
# exceptions does not pull in demangling by default, which increases code size
'mangle': (['-O2', '-fexceptions',
'-sDEMANGLE_SUPPORT', '-Wno-deprecated'], [], ['waka']), # noqa
'-sEXPORTED_FUNCTIONS=_main,_free,___cxa_demangle', '-Wno-deprecated'], [], ['waka']), # noqa
# Wasm EH's code size increase is smaller than that of Emscripten EH
'except_wasm': (['-O2', '-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS=0'], [], ['waka']),
'except_wasm_legacy': (['-O2', '-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS'], [], ['waka']),
Expand Down Expand Up @@ -9262,19 +9264,9 @@ def test_codesize_libcxxabi_message(self, *args):
def test_codesize_files(self, *args):
self.run_codesize_test('files.cpp', *args)

# ensures runtime exports work, even with metadce
@parameterized({
'': (False,),
'legacy': (True,)
})
def test_exported_runtime_methods_metadce(self, use_legacy_name):
def test_exported_runtime_methods_metadce(self):
exports = ['stackSave', 'stackRestore', 'stackAlloc', 'FS']
setting_name = 'EXPORTED_RUNTIME_METHODS'
if use_legacy_name:
setting_name = 'EXTRA_EXPORTED_RUNTIME_METHODS'
err = self.run_process([EMCC, test_file('hello_world.c'), '-Os', '-s%s=%s' % (setting_name, ','.join(exports))], stderr=PIPE).stderr
if use_legacy_name:
self.assertContained('warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated (please use EXPORTED_RUNTIME_METHODS instead). Please open a bug if you have a continuing need for this setting [-Wdeprecated]', err)
self.run_process([EMCC, test_file('hello_world.c'), '-Os', '-sEXPORTED_RUNTIME_METHODS=%s' % ','.join(exports)])
js = read_file('a.out.js')
for export in exports:
self.assertContained(f'Module["{export}"]', js)
Expand Down Expand Up @@ -12956,24 +12948,6 @@ def test_default_to_cxx(self):
self.run_process([EMCC, '-x', 'c++-header', '-c', 'cxxfoo.h'])
self.run_process([EMCC, '-x', 'c++', '-c', 'cxxfoo.h'])

@parameterized({
'': ([],),
'minimal': (['-sMINIMAL_RUNTIME', '-sSUPPORT_ERRNO'],),
})
def test_support_errno(self, args):
self.emcc_args += args + ['-sEXPORTED_FUNCTIONS=_main,___errno_location', '-Wno-deprecated']

self.do_other_test('test_support_errno.c')
size_default = os.path.getsize('test_support_errno.js')

# Run the same test again but with SUPPORT_ERRNO disabled. This time we don't expect errno
# to be set after the failing syscall.
self.emcc_args += ['-sSUPPORT_ERRNO=0']
self.do_other_test('test_support_errno.c', out_suffix='_disabled')

# Verify the JS output was smaller
self.assertLess(os.path.getsize('test_support_errno.js'), size_default)

def test_assembly(self):
self.run_process([EMCC, '-c', test_file('other/test_asm.s'), '-o', 'foo.o'])
self.do_other_test('test_asm.c', libraries=['foo.o'])
Expand Down
8 changes: 0 additions & 8 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,6 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915
if s in user_settings:
diagnostics.warning('deprecated', f'{s} is deprecated ({reason}). Please open a bug if you have a continuing need for this setting')

if settings.EXTRA_EXPORTED_RUNTIME_METHODS:
settings.EXPORTED_RUNTIME_METHODS += settings.EXTRA_EXPORTED_RUNTIME_METHODS

# If no output format was specified we try to deduce the format based on
# the output filename extension
if not options.oformat and (options.relocatable or (options.shared and not settings.SIDE_MODULE)):
Expand Down Expand Up @@ -1303,10 +1300,6 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915
'_wasmfs_get_cwd',
]

if settings.DEMANGLE_SUPPORT:
settings.REQUIRED_EXPORTS += ['__cxa_demangle', 'free']
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE += ['$demangle', '$stackTrace']

if settings.FULL_ES3:
settings.FULL_ES2 = 1
settings.MAX_WEBGL_VERSION = max(2, settings.MAX_WEBGL_VERSION)
Expand Down Expand Up @@ -1799,7 +1792,6 @@ def get_full_import_name(name):
# Some settings make no sense when not linking as C++
if not settings.LINK_AS_CXX:
cxx_only_settings = [
'DEMANGLE_SUPPORT',
'EXCEPTION_DEBUG',
'DISABLE_EXCEPTION_CATCHING',
'EXCEPTION_CATCHING_ALLOWED',
Expand Down
3 changes: 0 additions & 3 deletions tools/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@
#
# All settings here should be tagged as `[deprecated]` in settings.js
DEPRECATED_SETTINGS = {
'SUPPORT_ERRNO': 'emscripten no longer uses the setErrNo library function',
'EXTRA_EXPORTED_RUNTIME_METHODS': 'please use EXPORTED_RUNTIME_METHODS instead',
'DEMANGLE_SUPPORT': 'mangled names no longer appear in stack traces',
'RUNTIME_LINKED_LIBS': 'you can simply list the libraries directly on the commandline now',
'CLOSURE_WARNINGS': 'use -Wclosure instead',
'LEGALIZE_JS_FFI': 'to disable JS type legalization use `-sWASM_BIGINT` or `-sSTANDALONE_WASM`',
Expand Down