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
8 changes: 3 additions & 5 deletions src/lib/libdylink.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,10 @@ var LibraryDylink = {
continue;
}
#endif
if (typeof value?.value != 'undefined') {
// a breaking change in the wasm spec, globals are now objects
// https://github.com/WebAssembly/mutable-global/issues/1
// Detect wasm global exports. These represent data addresses
// which are relative to `memoryBase`
if (value instanceof WebAssembly.Global) {
value = value.value;
}
if (typeof value == {{{ POINTER_JS_TYPE }}}) {
value += {{{ to64('memoryBase') }}};
}
relocated[e] = value;
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_dylink.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 26931,
"a.out.js.gz": 11472,
"a.out.js": 26912,
"a.out.js.gz": 11470,
"a.out.nodebug.wasm": 18567,
"a.out.nodebug.wasm.gz": 9199,
"total": 45498,
"total_gz": 20671,
"total": 45479,
"total_gz": 20669,
"sent": [
"__heap_base",
"__indirect_function_table",
Expand Down
4 changes: 2 additions & 2 deletions test/codesize/test_codesize_hello_dylink_all.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"a.out.js": 245841,
"a.out.js": 245822,
"a.out.nodebug.wasm": 597746,
"total": 843587,
"total": 843568,
"sent": [
"IMG_Init",
"IMG_Load",
Expand Down
3 changes: 3 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,9 @@ def test_exclude_file(self):
def test_dylink_strict(self):
self.do_run_in_out_file_test('hello_world.c', cflags=['-sSTRICT', '-sMAIN_MODULE=1'])

def test_dylink_legacy(self):
self.do_run_in_out_file_test('hello_world.c', cflags=['-sLEGACY_GL_EMULATION', '-sMAIN_MODULE=2'])

def test_dylink_exceptions_and_assertions(self):
# Linking side modules using the STL and exceptions should not abort with
# "function in Table but not functionsInTableMap" when using ASSERTIONS=2
Expand Down
9 changes: 9 additions & 0 deletions tools/feature_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@


class Feature(IntEnum):
MUTABLE_GLOBALS = auto()
NON_TRAPPING_FPTOINT = auto()
SIGN_EXT = auto()
BULK_MEMORY = auto()
Expand All @@ -48,6 +49,12 @@ class Feature(IntEnum):
enable_override_features = set()

min_browser_versions = {
Feature.MUTABLE_GLOBALS: {
'chrome': 74,
'firefox': 61,
'safari': 130100,
'node': 120000,
},
Feature.NON_TRAPPING_FPTOINT: {
'chrome': 75,
'firefox': 65,
Expand Down Expand Up @@ -213,6 +220,8 @@ def apply_min_browser_versions():
enable_feature(Feature.BULK_MEMORY, 'pthreads')
elif settings.WASM_WORKERS or settings.SHARED_MEMORY:
enable_feature(Feature.BULK_MEMORY, 'shared-mem')
if settings.RELOCATABLE:
Copy link
Member

Choose a reason for hiding this comment

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

Were you not hoping to remove this setting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I will replace this with MAIN_MODULE as part of that change.

enable_feature(Feature.MUTABLE_GLOBALS, 'dynamic linking')
if settings.MEMORY64 == 1:
enable_feature(Feature.MEMORY64, 'MEMORY64')
if settings.EXPORT_ES6 and settings.PTHREADS:
Expand Down