Skip to content

Commit 89ec839

Browse files
authored
Add wasm exception handling support to sdl2_image port (#23554)
`sdl2_image` uses setjmp/longjmp so it needs to be aware of wasm exception handling.
1 parent 1df360c commit 89ec839

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

test/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,9 @@ def require_wasm_eh(self):
10641064
self.node_args.append('--experimental-wasm-exnref')
10651065
return
10661066

1067+
if self.is_browser_test():
1068+
return
1069+
10671070
if config.V8_ENGINE and config.V8_ENGINE in self.js_engines:
10681071
self.emcc_args.append('-sENVIRONMENT=shell')
10691072
self.js_engines = [config.V8_ENGINE]

test/test_browser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from common import BrowserCore, RunnerCore, path_from_root, has_browser, EMTEST_BROWSER, Reporting
2525
from common import create_file, parameterized, ensure_dir, disabled, test_file, WEBIDL_BINDER
2626
from common import read_file, EMRUN, no_wasm64, no_2gb, no_4gb
27-
from common import requires_wasm2js, parameterize, find_browser_test_file
27+
from common import requires_wasm2js, parameterize, find_browser_test_file, with_all_sjlj
2828
from common import also_with_minimal_runtime, also_with_wasm2js, also_with_asan
2929
from tools import shared
3030
from tools import ports
@@ -2956,6 +2956,7 @@ def test_sdl2_image_jpeg(self):
29562956

29572957
@also_with_wasmfs
29582958
@requires_graphics_hardware
2959+
@with_all_sjlj
29592960
def test_sdl2_image_formats(self):
29602961
shutil.copy(test_file('screenshot.png'), '.')
29612962
shutil.copy(test_file('screenshot.jpg'), '.')

tools/ports/sdl2_image.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def get_lib_name(settings):
4646
libname += '-' + formats
4747
if settings.PTHREADS:
4848
libname += '-mt'
49+
if settings.SUPPORT_LONGJMP == 'wasm':
50+
libname += '-wasm-sjlj'
4951
return libname + '.a'
5052

5153

@@ -77,6 +79,9 @@ def create(final):
7779
if settings.PTHREADS:
7880
flags += ['-pthread']
7981

82+
if settings.SUPPORT_LONGJMP == 'wasm':
83+
flags.append('-sSUPPORT_LONGJMP=wasm')
84+
8085
ports.build_port(src_dir, final, 'sdl2_image', flags=flags, srcs=srcs)
8186

8287
return [shared.cache.get_lib(libname, create, what='port')]

0 commit comments

Comments
 (0)