You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use wasmImports as the single global symbol table for dynamic linking
Previously we were looking up symbols on the `Module` object which
meant building with `EXPORT_ALL` and exporting all symbols there. This
change adds all needed symbols to the `wasmImports` maps and uses that
as the single source for symbol lookups.
This is split out from my work on #18376.
This should be a code size win in for most users of dynamic linking. It
also avoids extra symbols being present on the `Module` object that the
user didn't ask for.
diagnostics.warning('unused-command-line-argument', 'EXPORTED_FUNCTIONS is not valid with LINKABLE set (normally due to SIDE_MODULE=1/MAIN_MODULE=1) since all functions are exported this mode. To export only a subset use SIDE_MODULE=2/MAIN_MODULE=2')
// Create a stub for this symbol which can later be replaced by the
275
+
// dynamic linker. If this stub is called before the symbol is
276
+
// resolved assert in debug builds or trap in release builds.
277
+
if(ASYNCIFY){
278
+
// See the definition of asyncifyStubs in preamble.js for why this
279
+
// is needed.
280
+
target=`asyncifyStubs['${symbol}']`;
281
+
}else{
282
+
target=`wasmImports['${symbol}']`;
283
+
}
275
284
letassertion='';
276
285
if(ASSERTIONS){
277
-
assertion+=`if (!${target}) abort("external symbol '${symbol}' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment");\n`;
286
+
assertion+=`if (!${target} || ${target}.stub) abort("external symbol '${symbol}' is missing. perhaps a side module was not linked in? if this function was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment");\n`;
0 commit comments