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
Detect direct/internal usage of all missing library symbols (#17418)
Previously this mechanism only worked for missing function symbols and
would only fire once the function was called. The new mechanism will
catch any access to missing functions, even if they never called, and
will also catch access to missing number symbols.
I've also optimized the size of the `missingLibrarySymbol` block in
the generate code:
Old:
missingLibrarySymbol('foo');
missingLibrarySymbol('bar');
...
New:
var missingLibrarySymbols = ['foo', 'bar' ...];
missingLibrarySymbols.forEach(missingLibrarySymbol);
Copy file name to clipboardExpand all lines: src/runtime_debug.js
+35-10Lines changed: 35 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -22,24 +22,49 @@ function ignoredModuleProp(prop) {
22
22
}
23
23
}
24
24
25
-
functionunexportedMessage(sym,isFSSybol){
26
-
varmsg="'"+sym+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";
27
-
if(isFSSybol){
28
-
msg+='. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
29
-
}
30
-
returnmsg;
25
+
// forcing the filesystem exports a few things by default
26
+
functionisExportedByForceFilesystem(name){
27
+
returnname==='FS_createPath'||
28
+
name==='FS_createDataFile'||
29
+
name==='FS_createPreloadedFile'||
30
+
name==='FS_unlink'||
31
+
name==='addRunDependency'||
32
+
#if !WASMFS
33
+
// The old FS has some functionality that WasmFS lacks.
34
+
name==='FS_createLazyFile'||
35
+
name==='FS_createDevice'||
36
+
#endif
37
+
name==='removeRunDependency';
31
38
}
32
39
33
-
functionmissingLibraryFunc(sym){
34
-
return()=>abort('Call to `'+sym+'` which is a library function and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line');
// Can't `abort()` here because it would break code that does runtime
46
+
// checks. e.g. `if (typeof SDL === 'undefined')`.
47
+
varmsg='`'+sym+'` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line';
48
+
if(isExportedByForceFilesystem(sym)){
49
+
msg+='. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
50
+
}
51
+
warnOnce(msg);
52
+
returnundefined;
53
+
}
54
+
});
55
+
}
35
56
}
36
57
37
-
functionunexportedRuntimeSymbol(sym,isFSSybol){
58
+
functionunexportedRuntimeSymbol(sym){
38
59
if(!Object.getOwnPropertyDescriptor(Module,sym)){
39
60
Object.defineProperty(Module,sym,{
40
61
configurable: true,
41
62
get: function(){
42
-
abort(unexportedMessage(sym,isFSSybol));
63
+
varmsg="'"+sym+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";
64
+
if(isExportedByForceFilesystem(sym)){
65
+
msg+='. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
0 commit comments