diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-02 19:07:20 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-02 19:07:20 -0700 |
commit | 34bce791b6b1c34e85c5deda7fb71869dcdd6435 (patch) | |
tree | 9bb37cbfe10b3dc4377c3472074fd7023146a330 | |
parent | 0fdf95ce714591173bec8ef881db317f5cba5fa3 (diff) |
only emit aborting function stubs on undefined symbols in asm mode
-rw-r--r-- | src/jsifier.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 24fded72..46d8ae74 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -486,12 +486,18 @@ function JSify(data, functionsOnly, givenFunctions) { item.JS = ''; } else { // If this is not linkable, anything not in the library is definitely missing + var cancel = false; if (!LINKABLE && !LibraryManager.library.hasOwnProperty(shortident) && !LibraryManager.library.hasOwnProperty(shortident + '__inline')) { if (ERROR_ON_UNDEFINED_SYMBOLS) error('unresolved symbol: ' + shortident); if (VERBOSE || WARN_ON_UNDEFINED_SYMBOLS) printErr('warning: unresolved symbol: ' + shortident); - LibraryManager.library[shortident] = new Function("Module['printErr']('missing function: " + shortident + "'); abort(-1);"); + if (ASM_JS) { + // emit a stub that will fail during runtime. this allows asm validation to succeed. + LibraryManager.library[shortident] = new Function("Module['printErr']('missing function: " + shortident + "'); abort(-1);"); + } else { + cancel = true; // emit nothing, not even var X = undefined; + } } - item.JS = addFromLibrary(shortident); + item.JS = cancel ? ';' : addFromLibrary(shortident); } return ret; } |