aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js10
-rw-r--r--src/library.js5
-rwxr-xr-xsrc/relooper/doit.sh2
-rwxr-xr-xsrc/relooper/testit.sh2
-rwxr-xr-xsrc/relooper/updateit.sh1
5 files changed, 16 insertions, 4 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;
}
diff --git a/src/library.js b/src/library.js
index 3a966ec8..dc0dcdd2 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4442,9 +4442,10 @@ LibraryManager.library = {
strcat: function(pdest, psrc) {
pdest = pdest|0; psrc = psrc|0;
var i = 0;
- pdest = (pdest + (_strlen(pdest)|0))|0;
+ var pdestEnd = 0;
+ pdestEnd = (pdest + (_strlen(pdest)|0))|0;
do {
- {{{ makeCopyValues('pdest+i', 'psrc+i', 1, 'i8', null, 1) }}};
+ {{{ makeCopyValues('pdestEnd+i', 'psrc+i', 1, 'i8', null, 1) }}};
i = (i+1)|0;
} while ({{{ makeGetValueAsm('psrc', 'i-1', 'i8') }}});
return pdest|0;
diff --git a/src/relooper/doit.sh b/src/relooper/doit.sh
index bf2683d5..5a55dd79 100755
--- a/src/relooper/doit.sh
+++ b/src/relooper/doit.sh
@@ -1,3 +1,5 @@
+#!/bin/sh
+
echo "relooper"
g++ Relooper.cpp -c -g
g++ Relooper.cpp -c -g -DDEBUG -o RelooperDebug.o
diff --git a/src/relooper/testit.sh b/src/relooper/testit.sh
index 28413c0d..61e1a2fb 100755
--- a/src/relooper/testit.sh
+++ b/src/relooper/testit.sh
@@ -1,3 +1,5 @@
+#!/bin/sh
+
echo "test"
./test &> test.out
diff -U 5 test.txt test.out
diff --git a/src/relooper/updateit.sh b/src/relooper/updateit.sh
index 91ccd3ab..8c434753 100755
--- a/src/relooper/updateit.sh
+++ b/src/relooper/updateit.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
./test &> test.txt
./test2 &> test2.txt
./test3 &> test3.txt