aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emscripten-version.txt2
-rw-r--r--src/library_fs.js1
-rw-r--r--src/library_gl.js16
-rw-r--r--src/preamble.js1
-rw-r--r--system/lib/gl.c1
-rw-r--r--system/lib/libc/musl/src/string/strsignal.c115
-rw-r--r--system/lib/libcextra.symbols1
-rw-r--r--tests/dirent/test_readdir.c1
-rw-r--r--tests/test_core.py2
-rw-r--r--tests/test_other.py21
-rw-r--r--tools/system_libs.py1
11 files changed, 159 insertions, 3 deletions
diff --git a/emscripten-version.txt b/emscripten-version.txt
index 6318f232..a08cf9ed 100644
--- a/emscripten-version.txt
+++ b/emscripten-version.txt
@@ -1,2 +1,2 @@
-1.21.3
+1.21.4
diff --git a/src/library_fs.js b/src/library_fs.js
index 5fc2c203..a392e72e 100644
--- a/src/library_fs.js
+++ b/src/library_fs.js
@@ -676,6 +676,7 @@ mergeInto(LibraryManager.library, {
} catch (e) {
throw new FS.ErrnoError(ERRNO_CODES.EBUSY);
}
+ if (!old_dir || !new_dir) throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
// need to be part of the same mount
if (old_dir.mount !== new_dir.mount) {
throw new FS.ErrnoError(ERRNO_CODES.EXDEV);
diff --git a/src/library_gl.js b/src/library_gl.js
index ffcbef62..a4d560e7 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -698,6 +698,8 @@ var LibraryGL = {
// Extension available from Firefox 25 and WebKit
GL.vaoExt = Module.ctx.getExtension('OES_vertex_array_object');
+ GL.drawBuffersExt = Module.ctx.getExtension('WEBGL_draw_buffers');
+
// These are the 'safe' feature-enabling extensions that don't add any performance impact related to e.g. debugging, and
// should be enabled by default so that client GLES2/GL code will not need to go through extra hoops to get its stuff working.
// As new extensions are ratified at http://www.khronos.org/registry/webgl/extensions/ , feel free to add your new extensions
@@ -5423,7 +5425,19 @@ var LibraryGL = {
glVertexAttribDivisorARB: 'glVertexAttribDivisor',
glDrawArraysInstancedARB: 'glDrawArraysInstanced',
glDrawElementsInstancedARB: 'glDrawElementsInstanced',
-
+
+
+ glDrawBuffers__sig: 'vii',
+ glDrawBuffers: function(n, bufs) {
+#if GL_ASSERTIONS
+ assert(GL.drawBuffersExt, 'Must have WEBGL_draw_buffers extension to use drawBuffers');
+#endif
+ var bufArray = [];
+ for (var i = 0; i < n; i++)
+ bufArray.push({{{ makeGetValue('bufs', 'i*4', 'i32') }}});
+
+ GL.drawBuffersExt.drawBuffersWEBGL(bufArray);
+ },
// signatures of simple pass-through functions, see later
glActiveTexture__sig: 'vi',
diff --git a/src/preamble.js b/src/preamble.js
index e6d3f552..93f9292e 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -936,6 +936,7 @@ function stackTrace() {
var stack = new Error().stack;
return stack ? demangleAll(stack) : '(no stack trace available)'; // Stack trace is not available at least on IE10 and Safari 6.
}
+Module['stackTrace'] = stackTrace;
// Memory management
diff --git a/system/lib/gl.c b/system/lib/gl.c
index bbc77437..33e9fd47 100644
--- a/system/lib/gl.c
+++ b/system/lib/gl.c
@@ -1724,6 +1724,7 @@ void* emscripten_GetProcAddress(const char *name_) {
else if (!strcmp(name, "glVertexAttrib4f")) return emscripten_glVertexAttrib4f;
else if (!strcmp(name, "glCopyTexImage2D")) return emscripten_glCopyTexImage2D;
else if (!strcmp(name, "glCopyTexSubImage2D")) return emscripten_glCopyTexSubImage2D;
+ else if (!strcmp(name, "glDrawBuffers")) return emscripten_glDrawBuffers;
fprintf(stderr, "bad name in getProcAddress: %s | %s\n", name_, name);
return 0;
diff --git a/system/lib/libc/musl/src/string/strsignal.c b/system/lib/libc/musl/src/string/strsignal.c
new file mode 100644
index 00000000..905c0956
--- /dev/null
+++ b/system/lib/libc/musl/src/string/strsignal.c
@@ -0,0 +1,115 @@
+#include <signal.h>
+#include <string.h>
+
+#if (SIGHUP == 1) && (SIGINT == 2) && (SIGQUIT == 3) && (SIGILL == 4) \
+ && (SIGTRAP == 5) && (SIGABRT == 6) && (SIGBUS == 7) && (SIGFPE == 8) \
+ && (SIGKILL == 9) && (SIGUSR1 == 10) && (SIGSEGV == 11) && (SIGUSR2 == 12) \
+ && (SIGPIPE == 13) && (SIGALRM == 14) && (SIGTERM == 15) && (SIGSTKFLT == 16) \
+ && (SIGCHLD == 17) && (SIGCONT == 18) && (SIGSTOP == 19) && (SIGTSTP == 20) \
+ && (SIGTTIN == 21) && (SIGTTOU == 22) && (SIGURG == 23) && (SIGXCPU == 24) \
+ && (SIGXFSZ == 25) && (SIGVTALRM == 26) && (SIGPROF == 27) && (SIGWINCH == 28) \
+ && (SIGPOLL == 29) && (SIGPWR == 30) && (SIGSYS == 31)
+
+#define sigmap(x) x
+
+#else
+
+static const char map[] = {
+ [SIGHUP] = 1,
+ [SIGINT] = 2,
+ [SIGQUIT] = 3,
+ [SIGILL] = 4,
+ [SIGTRAP] = 5,
+ [SIGABRT] = 6,
+ [SIGBUS] = 7,
+ [SIGFPE] = 8,
+ [SIGKILL] = 9,
+ [SIGUSR1] = 10,
+ [SIGSEGV] = 11,
+ [SIGUSR2] = 12,
+ [SIGPIPE] = 13,
+ [SIGALRM] = 14,
+ [SIGTERM] = 15,
+ [SIGSTKFLT] = 16,
+ [SIGCHLD] = 17,
+ [SIGCONT] = 18,
+ [SIGSTOP] = 19,
+ [SIGTSTP] = 20,
+ [SIGTTIN] = 21,
+ [SIGTTOU] = 22,
+ [SIGURG] = 23,
+ [SIGXCPU] = 24,
+ [SIGXFSZ] = 25,
+ [SIGVTALRM] = 26,
+ [SIGPROF] = 27,
+ [SIGWINCH] = 28,
+ [SIGPOLL] = 29,
+ [SIGPWR] = 30,
+ [SIGSYS] = 31
+};
+
+#define sigmap(x) ((x) >= sizeof map ? (x) : map[(x)])
+
+#endif
+
+static const char strings[] =
+ "Unknown signal\0"
+ "Hangup\0"
+ "Interrupt\0"
+ "Quit\0"
+ "Illegal instruction\0"
+ "Trace/breakpoint trap\0"
+ "Aborted\0"
+ "Bus error\0"
+ "Arithmetic exception\0"
+ "Killed\0"
+ "User defined signal 1\0"
+ "Segmentation fault\0"
+ "User defined signal 2\0"
+ "Broken pipe\0"
+ "Alarm clock\0"
+ "Terminated\0"
+ "Stack fault\0"
+ "Child process status\0"
+ "Continued\0"
+ "Stopped (signal)\0"
+ "Stopped\0"
+ "Stopped (tty input)\0"
+ "Stopped (tty output)\0"
+ "Urgent I/O condition\0"
+ "CPU time limit exceeded\0"
+ "File size limit exceeded\0"
+ "Virtual timer expired\0"
+ "Profiling timer expired\0"
+ "Window changed\0"
+ "I/O possible\0"
+ "Power failure\0"
+ "Bad system call\0"
+ "RT32"
+ "\0RT33\0RT34\0RT35\0RT36\0RT37\0RT38\0RT39\0RT40"
+ "\0RT41\0RT42\0RT43\0RT44\0RT45\0RT46\0RT47\0RT48"
+ "\0RT49\0RT50\0RT51\0RT52\0RT53\0RT54\0RT55\0RT56"
+ "\0RT57\0RT58\0RT59\0RT60\0RT61\0RT62\0RT63\0RT64"
+#if _NSIG > 65
+ "\0RT65\0RT66\0RT67\0RT68\0RT69\0RT70\0RT71\0RT72"
+ "\0RT73\0RT74\0RT75\0RT76\0RT77\0RT78\0RT79\0RT80"
+ "\0RT81\0RT82\0RT83\0RT84\0RT85\0RT86\0RT87\0RT88"
+ "\0RT89\0RT90\0RT91\0RT92\0RT93\0RT94\0RT95\0RT96"
+ "\0RT97\0RT98\0RT99\0RT100\0RT101\0RT102\0RT103\0RT104"
+ "\0RT105\0RT106\0RT107\0RT108\0RT109\0RT110\0RT111\0RT112"
+ "\0RT113\0RT114\0RT115\0RT116\0RT117\0RT118\0RT119\0RT120"
+ "\0RT121\0RT122\0RT123\0RT124\0RT125\0RT126\0RT127\0RT128"
+#endif
+ "";
+
+char *strsignal(int signum)
+{
+ char *s = (char *)strings;
+
+ signum = sigmap(signum);
+ if (signum - 1U >= _NSIG-1) signum = 0;
+
+ for (; signum--; s++) for (; *s; s++);
+
+ return s;
+}
diff --git a/system/lib/libcextra.symbols b/system/lib/libcextra.symbols
index 1ab849bd..2c004699 100644
--- a/system/lib/libcextra.symbols
+++ b/system/lib/libcextra.symbols
@@ -242,3 +242,4 @@
T wmemset
T wprintf
T fnmatch
+ T strsignal
diff --git a/tests/dirent/test_readdir.c b/tests/dirent/test_readdir.c
index 12f97b73..dc14a147 100644
--- a/tests/dirent/test_readdir.c
+++ b/tests/dirent/test_readdir.c
@@ -125,6 +125,7 @@ void test() {
}
int main() {
+ printf("SIGILL: %s\n", strsignal(SIGILL));
atexit(cleanup);
signal(SIGABRT, cleanup);
setup();
diff --git a/tests/test_core.py b/tests/test_core.py
index eb1cf405..a975e1e1 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4198,7 +4198,7 @@ def process(filename):
def test_readdir(self):
src = open(path_from_root('tests', 'dirent', 'test_readdir.c'), 'r').read()
- self.do_run(src, 'success', force_c=True)
+ self.do_run(src, 'SIGILL: Illegal instruction\nsuccess', force_c=True)
def test_readdir_empty(self):
src = open(path_from_root('tests', 'dirent', 'test_readdir_empty.c'), 'r').read()
diff --git a/tests/test_other.py b/tests/test_other.py
index f877d15e..0f71751a 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -3050,6 +3050,27 @@ int main(int argc, char **argv) {
self.assertContained(r'''ok''', run_js('a.out.js', args=['123', 'abc']))
self.assertContained(r'''Failed to symlink paths: abc, ; errno=2''', run_js('a.out.js', args=['abc', '']))
+ def test_rename_silly(self):
+ open('src.cpp', 'w').write(r'''
+#include <stdio.h>
+#include <errno.h>
+
+int main(int argc, char **argv) {
+ if (rename(argv[1], argv[2]) != 0) {
+ printf("Failed to rename paths: %s, %s; errno=%d\n", argv[1], argv[2], errno);
+ } else {
+ printf("ok\n");
+ }
+}
+ ''')
+ Popen([PYTHON, EMCC, 'src.cpp']).communicate()
+
+ # cannot symlink nonexistents
+ self.assertContained(r'''Failed to rename paths: , abc; errno=2''', run_js('a.out.js', args=['', 'abc']))
+ self.assertContained(r'''Failed to rename paths: , ; errno=2''', run_js('a.out.js', args=['', '']))
+ self.assertContained(r'''Failed to rename paths: 123, abc; errno=2''', run_js('a.out.js', args=['123', 'abc']))
+ self.assertContained(r'''Failed to rename paths: abc, ; errno=2''', run_js('a.out.js', args=['abc', '']))
+
def test_emversion(self):
open('src.cpp', 'w').write(r'''
#include <stdio.h>
diff --git a/tools/system_libs.py b/tools/system_libs.py
index 9e904b80..0cfa7d1a 100644
--- a/tools/system_libs.py
+++ b/tools/system_libs.py
@@ -340,6 +340,7 @@ def calculate(temp_files, in_temp, stdout_, stderr_):
'strpbrk.c',
'strrchr.c',
'strsep.c',
+ 'strsignal.c',
'strspn.c',
'strstr.c',
'strtok.c',