[EH] Fix JS deps when linking without -fexceptions by aheejin · Pull Request #27708 · emscripten-core/emscripten · GitHub
Skip to content

[EH] Fix JS deps when linking without -fexceptions - #27708

Open
aheejin wants to merge 1 commit into
emscripten-core:mainfrom
aheejin:em_eh_deps
Open

aheejin wants to merge 1 commit into
emscripten-core:mainfrom
aheejin:em_eh_deps

Conversation

@aheejin

@aheejin aheejin commented Sep 15, 2026

Copy link
Copy Markdown
Member

Several Emscripten EH-related JS variables were gated under if !DISABLE_EXCEPTION_CATCHING, making them unavailable at the link time if -fexceptions was not given. It may not be given due to a command argument mismatch, or because the code was not using EH but setjmp/longjmp.

This PR makes setTempRet0 and ExceptionInfo dependent on the method they were called in, rather than gating them behind if !DISABLE_EXCEPTION_CATCHING.

This also exports setThrew when SUPPORT_LONGJMP is true too, because setThrew is called from invokes, which can be also generated from Emscripten setjmp/longjmp handling. (And also when the options mismatch between the compile time and link time, as in #27703)

Fixes #27703.

Several Emscripten EH-related JS variables were gated under
`if !DISABLE_EXCEPTION_CATCHING`, making them unavailable at the link
time if `-fexceptions` was not given. It may not be given due to a
command argument mismatch, or because the code was not using EH but
setjmp/longjmp.

This PR makes `setTempRet0` and `ExceptionInfo` dependent on the method
they were called in, rather than gating them behind
`if !DISABLE_EXCEPTION_CATCHING`.

This also exports `setThrew` when `SUPPORT_LONGJMP` is true too, because
`setThrew` is called from invokes, which can be also generated from
Emscripten setjmp/longjmp handling. (And also when the options mismatch
between the compile time and link time, as in emscripten-core#27703)

Fixes emscripten-core#27703.
@aheejin
aheejin requested a review from sbc100 September 15, 2026 09:06
Comment thread src/lib/libexceptions.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray ] here: when DISABLE_EXCEPTION_CATCHING is off this line already closes the array, so the unconditional ], below becomes a syntax error - that is the libexceptions.preprocessed.js:200 SyntaxError: Unexpected token ']' on the CI. Should end with '__cxa_can_catch',.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing JS library deps with DISABLE_EXCEPTION_CATCHING=1: closure reports _setThrew, setTempRet0, ExceptionInfo undeclared

2 participants