diff --git a/ChangeLog.md b/ChangeLog.md index c9c532be3cf2c..65a1b2a438d29 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -22,7 +22,10 @@ See docs/process.md for more on how version tagging works. ---------------------- - `EXPORT_EXCEPTION_HANDLING_HELPERS` is deprecated and setting it will not do anything. `getExceptionMessage` is exported anyway when `ASSERTIONS` or - `EXCEPTION_STACK_TRACES` is set, which are set by default at `-O0`. (#26499) + `EXCEPTION_STACK_TRACES` is set, which are set by default at `-O0`. At `-O1` + or above, you can export it separately by + `-sEXPORTED_RUNTIME_METHODS=getExceptionMessage,decrementExceptionRefcount`. + (#26499) - The deprecated `EMSCRIPTEN` macro is now defined in `emscripten.h` rather than on the command line (`__EMSCRIPTEN__`, which is built into LLVM, should be used instead). (#26417) diff --git a/site/source/docs/porting/exceptions.rst b/site/source/docs/porting/exceptions.rst index 250d7f193e553..cfd96b506d7fc 100644 --- a/site/source/docs/porting/exceptions.rst +++ b/site/source/docs/porting/exceptions.rst @@ -146,7 +146,8 @@ exception thrown``, this code will print ``MyException,My exception thrown``. ``getExceptionMessage`` is available when exceptions are used and either ``-sASSERTIONS`` or ``-sEXCEPTION_STACK_TRACES`` is set, which are by default -true at ``-O0``. +true at ``-O0``. At ``-O1`` or above, you can export it separately by +``-sEXPORTED_RUNTIME_METHODS=getExceptionMessage,decrementExceptionRefcount``. If the stack pointer has been moved due to stack allocations within the Wasm function before an exception is thrown, you can use ``stackSave()`` and diff --git a/site/source/docs/tools_reference/settings_reference.rst b/site/source/docs/tools_reference/settings_reference.rst index ef836d053bbf5..b7777880f414b 100644 --- a/site/source/docs/tools_reference/settings_reference.rst +++ b/site/source/docs/tools_reference/settings_reference.rst @@ -3419,7 +3419,7 @@ these settings please open a bug (or reply to one of the existing bugs). - ``LEGALIZE_JS_FFI``: to disable JS type legalization use `-sWASM_BIGINT` or `-sSTANDALONE_WASM` - ``ASYNCIFY_EXPORTS``: please use JSPI_EXPORTS instead - ``LINKABLE``: under consideration for removal (https://github.com/emscripten-core/emscripten/issues/25262) - - ``EXPORT_EXCEPTION_HANDLING_HELPERS``: getExceptionMessage is automatically exported when ASSERTIONS or EXCEPTION_STACK_TRACES is 1 and throw is used + - ``EXPORT_EXCEPTION_HANDLING_HELPERS``: getExceptionMessage is exported anyway when ASSERTIONS or EXCEPTION_STACK_TRACES is set, which are set by default at -O0. At -O1 or above, you can export it separately by -sEXPORTED_RUNTIME_METHODS=getExceptionMessage,decrementExceptionRefcount. .. _legacy-settings: diff --git a/tools/settings.py b/tools/settings.py index bea1cd583e2f6..7032b99b86552 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -114,7 +114,7 @@ 'LEGALIZE_JS_FFI': 'to disable JS type legalization use `-sWASM_BIGINT` or `-sSTANDALONE_WASM`', 'ASYNCIFY_EXPORTS': 'please use JSPI_EXPORTS instead', 'LINKABLE': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/25262)', - 'EXPORT_EXCEPTION_HANDLING_HELPERS': 'getExceptionMessage is automatically exported when ASSERTIONS or EXCEPTION_STACK_TRACES is 1 and throw is used', + 'EXPORT_EXCEPTION_HANDLING_HELPERS': 'getExceptionMessage is exported anyway when ASSERTIONS or EXCEPTION_STACK_TRACES is set, which are set by default at -O0. At -O1 or above, you can export it separately by -sEXPORTED_RUNTIME_METHODS=getExceptionMessage,decrementExceptionRefcount.', } # Settings that don't need to be externalized when serializing to json because they