Skip to content

Commit a58e96f

Browse files
authored
Fix signatures of dlopen/dlsym stub functions (#19514)
1 parent b8ed4a9 commit a58e96f

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

src/library_dylink.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,13 @@ var LibraryDylink = {
342342
_dlsym_catchup_js: function(handle, symbolIndex) {
343343
abort(dlopenMissingError);
344344
},
345-
dlopen: function(handle) {
345+
dlopen: function(filename, flags) {
346346
abort(dlopenMissingError);
347347
},
348348
emscripten_dlopen: function(handle, onsuccess, onerror, user_data) {
349349
abort(dlopenMissingError);
350350
},
351-
__dlsym: function(handle, symbol) {
351+
__dlsym: function(handle, symbol, ra) {
352352
abort(dlopenMissingError);
353353
},
354354
#else // MAIN_MODULE != 0

test/common.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,23 @@ def metafunc(self, with_bigint):
301301
return metafunc
302302

303303

304+
def also_with_wasm64(f):
305+
assert callable(f)
306+
307+
def metafunc(self, with_wasm64):
308+
if with_wasm64:
309+
self.require_wasm64()
310+
self.set_setting('MEMORY64')
311+
self.emcc_args.append('-Wno-experimental')
312+
f(self)
313+
else:
314+
f(self)
315+
316+
metafunc._parameterize = {'': (False,),
317+
'wasm64': (True,)}
318+
return metafunc
319+
320+
304321
# This works just like `with_both_eh_sjlj` above but doesn't enable exceptions.
305322
# Use this for tests that use setjmp/longjmp but not exceptions handling.
306323
def with_both_sjlj(f):

test/test_browser.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

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
26-
from common import read_file, requires_v8, also_with_minimal_runtime, EMRUN
26+
from common import read_file, requires_v8, also_with_minimal_runtime, also_with_wasm64, EMRUN
2727
from tools import shared
2828
from tools import ports
2929
from tools import utils
@@ -108,22 +108,6 @@ def metafunc(self, with_wasm2js):
108108
return metafunc
109109

110110

111-
def also_with_wasm64(f):
112-
assert callable(f)
113-
114-
def metafunc(self, with_wasm64):
115-
if with_wasm64:
116-
self.set_setting('MEMORY64')
117-
self.emcc_args.append('-Wno-experimental')
118-
f(self)
119-
else:
120-
f(self)
121-
122-
metafunc._parameterize = {'': (False,),
123-
'wasm64': (True,)}
124-
return metafunc
125-
126-
127111
def also_with_wasm2js_or_wasm64(f):
128112
assert callable(f)
129113

@@ -233,6 +217,10 @@ def setUp(self):
233217
'-Wno-int-conversion',
234218
]
235219

220+
def require_wasm64(self):
221+
# All the browser we run on support wasm64
222+
return True
223+
236224
def test_sdl1_in_emscripten_nonstrict_mode(self):
237225
if 'EMCC_STRICT' in os.environ and int(os.environ['EMCC_STRICT']):
238226
self.skipTest('This test requires being run in non-strict mode (EMCC_STRICT env. variable unset)')

test/test_other.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
3535
from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64
3636
from common import requires_wasm_eh, crossplatform, with_both_sjlj
37-
from common import also_with_minimal_runtime, also_with_wasm_bigint, EMTEST_BUILD_VERBOSE, PYTHON
37+
from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64
38+
from common import EMTEST_BUILD_VERBOSE, PYTHON
3839
from tools import shared, building, utils, response_file, cache
3940
from tools.utils import read_file, write_file, delete_file, read_binary
4041
import common
@@ -12204,8 +12205,9 @@ def test_unimplemented_syscalls(self, args):
1220412205
err = self.run_js('a.out.js')
1220512206
self.assertNotContained('warning: unsupported syscall', err)
1220612207

12208+
@also_with_wasm64
1220712209
def test_unimplemented_syscalls_dlopen(self):
12208-
cmd = [EMCC, test_file('other/test_dlopen_blocking.c')]
12210+
cmd = [EMCC, test_file('other/test_dlopen_blocking.c')] + self.get_emcc_args()
1220912211
self.run_process(cmd)
1221012212
err = self.run_js('a.out.js', assert_returncode=NON_ZERO)
1221112213
self.assertContained('Aborted(To use dlopen, you need enable dynamic linking, see https://emscripten.org/docs/compiling/Dynamic-Linking.html)', err)

0 commit comments

Comments
 (0)