@@ -2420,6 +2420,14 @@ def phase_linker_setup(options, state, newargs):
2420
2420
if settings .INCLUDE_FULL_LIBRARY and not settings .DISABLE_EXCEPTION_CATCHING :
2421
2421
settings .EXPORTED_FUNCTIONS += ['___get_exception_message' , '_free' ]
2422
2422
2423
+ if settings .MEMORY64 :
2424
+ if settings .ASYNCIFY and settings .MEMORY64 == 1 :
2425
+ exit_with_error ('MEMORY64=1 is not compatible with ASYNCIFY' )
2426
+ if not settings .DISABLE_EXCEPTION_CATCHING :
2427
+ exit_with_error ('MEMORY64 is not compatible with DISABLE_EXCEPTION_CATCHING=0' )
2428
+ # Any "pointers" passed to JS will now be i64's, in both modes.
2429
+ settings .WASM_BIGINT = 1
2430
+
2423
2431
if settings .WASM_WORKERS :
2424
2432
# TODO: After #15982 is resolved, these dependencies can be declared in library_wasm_worker.js
2425
2433
# instead of having to record them here.
@@ -2432,13 +2440,19 @@ def phase_linker_setup(options, state, newargs):
2432
2440
settings .WASM_WORKER_FILE = unsuffixed (os .path .basename (target )) + '.ww.js'
2433
2441
settings .JS_LIBRARIES .append ((0 , shared .path_from_root ('src' , 'library_wasm_worker.js' )))
2434
2442
2443
+ # Set min browser versions based on certain settings such as WASM_BIGINT,
2444
+ # PTHREADS, AUDIO_WORKLET
2445
+ # Such setting must be set before this point
2446
+ feature_matrix .apply_min_browser_versions ()
2447
+
2448
+ # TODO(sbc): Find make a generic way to expose the feature matrix to JS
2449
+ # compiler rather then adding them all ad-hoc as internal settings
2435
2450
settings .SUPPORTS_GLOBALTHIS = feature_matrix .caniuse (feature_matrix .Feature .GLOBALTHIS )
2451
+ settings .SUPPORTS_PROMISE_ANY = feature_matrix .caniuse (feature_matrix .Feature .PROMISE_ANY )
2436
2452
if not settings .BULK_MEMORY :
2437
2453
settings .BULK_MEMORY = feature_matrix .caniuse (feature_matrix .Feature .BULK_MEMORY )
2438
2454
2439
2455
if settings .AUDIO_WORKLET :
2440
- if not settings .SUPPORTS_GLOBALTHIS :
2441
- exit_with_error ('Must target recent enough browser versions that will support globalThis in order to target Wasm Audio Worklets!' )
2442
2456
if settings .AUDIO_WORKLET == 1 :
2443
2457
settings .AUDIO_WORKLET_FILE = unsuffixed (os .path .basename (target )) + '.aw.js'
2444
2458
settings .JS_LIBRARIES .append ((0 , shared .path_from_root ('src' , 'library_webaudio.js' )))
@@ -2552,14 +2566,6 @@ def check_memory_setting(setting):
2552
2566
if settings .SHARED_MEMORY or settings .RELOCATABLE or settings .ASYNCIFY_LAZY_LOAD_CODE or settings .WASM2JS :
2553
2567
settings .IMPORTED_MEMORY = 1
2554
2568
2555
- if settings .MEMORY64 :
2556
- if settings .ASYNCIFY and settings .MEMORY64 == 1 :
2557
- exit_with_error ('MEMORY64=1 is not compatible with ASYNCIFY' )
2558
- if not settings .DISABLE_EXCEPTION_CATCHING :
2559
- exit_with_error ('MEMORY64 is not compatible with DISABLE_EXCEPTION_CATCHING=0' )
2560
- # Any "pointers" passed to JS will now be i64's, in both modes.
2561
- settings .WASM_BIGINT = 1
2562
-
2563
2569
if settings .WASM_BIGINT :
2564
2570
settings .LEGALIZE_JS_FFI = 0
2565
2571
@@ -2900,8 +2906,6 @@ def get_full_import_name(name):
2900
2906
if settings .WASM_EXCEPTIONS :
2901
2907
settings .EXPORTED_FUNCTIONS += ['___cpp_exception' , '___cxa_increment_exception_refcount' , '___cxa_decrement_exception_refcount' , '___thrown_object_from_unwind_exception' ]
2902
2908
2903
- feature_matrix .apply_min_browser_versions ()
2904
-
2905
2909
if settings .SIDE_MODULE :
2906
2910
# For side modules, we ignore all REQUIRED_EXPORTS that might have been added above.
2907
2911
# They all come from either libc or compiler-rt. The exception is __wasm_call_ctors
0 commit comments