aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2014-03-15 19:31:14 +0200
committerJukka Jylänki <jujjyl@gmail.com>2014-03-28 23:06:16 -0400
commit4c601e62b9d7cf6a2a873c6886f701ad7de31fde (patch)
tree3506c1fe13376cc25fac5cce84aa65b2dc6be8d5
parent161e3630125de2b4431f99c65d2b2a9198400fa9 (diff)
Added musl 0.9.13 bcmp and bzero functions and migrated bcopy implementation to use musl for better asm.js performance.
-rw-r--r--src/library.js7
-rw-r--r--system/lib/libc/musl/src/string/bcmp.c7
-rw-r--r--system/lib/libc/musl/src/string/bcopy.c7
-rw-r--r--system/lib/libc/musl/src/string/bzero.c7
-rw-r--r--system/lib/libcextra.symbols3
-rw-r--r--tools/system_libs.py3
6 files changed, 27 insertions, 7 deletions
diff --git a/src/library.js b/src/library.js
index fed4fd43..a146eb7d 100644
--- a/src/library.js
+++ b/src/library.js
@@ -3522,13 +3522,6 @@ LibraryManager.library = {
llvm_memmove_p0i8_p0i8_i32: 'memmove',
llvm_memmove_p0i8_p0i8_i64: 'memmove',
- bcopy__deps: ['memmove'],
- bcopy: function(src, dest, num) {
- // void bcopy(const void *s1, void *s2, size_t n);
- // http://pubs.opengroup.org/onlinepubs/009695399/functions/bcopy.html
- _memmove(dest, src, num);
- },
-
memset__inline: function(ptr, value, num, align) {
return makeSetValues(ptr, 0, value, 'null', num, align);
},
diff --git a/system/lib/libc/musl/src/string/bcmp.c b/system/lib/libc/musl/src/string/bcmp.c
new file mode 100644
index 00000000..5d6a388b
--- /dev/null
+++ b/system/lib/libc/musl/src/string/bcmp.c
@@ -0,0 +1,7 @@
+#include <string.h>
+#include <strings.h>
+
+int bcmp(const void *s1, const void *s2, size_t n)
+{
+ return memcmp(s1, s2, n);
+}
diff --git a/system/lib/libc/musl/src/string/bcopy.c b/system/lib/libc/musl/src/string/bcopy.c
new file mode 100644
index 00000000..e76272fc
--- /dev/null
+++ b/system/lib/libc/musl/src/string/bcopy.c
@@ -0,0 +1,7 @@
+#include <string.h>
+#include <strings.h>
+
+void bcopy(const void *s1, void *s2, size_t n)
+{
+ memmove(s2, s1, n);
+}
diff --git a/system/lib/libc/musl/src/string/bzero.c b/system/lib/libc/musl/src/string/bzero.c
new file mode 100644
index 00000000..0f98b4a5
--- /dev/null
+++ b/system/lib/libc/musl/src/string/bzero.c
@@ -0,0 +1,7 @@
+#include <string.h>
+#include <strings.h>
+
+void bzero(void *s, size_t n)
+{
+ memset(s, 0, n);
+}
diff --git a/system/lib/libcextra.symbols b/system/lib/libcextra.symbols
index b4528c50..6620faa9 100644
--- a/system/lib/libcextra.symbols
+++ b/system/lib/libcextra.symbols
@@ -23,6 +23,9 @@
T __wcsxfrm_l
W __wctype_l
T atoll
+ T bcmp
+ T bcopy
+ T bzero
T bsearch
T btowc
T ecvt
diff --git a/tools/system_libs.py b/tools/system_libs.py
index 5fadb60f..086b8ddd 100644
--- a/tools/system_libs.py
+++ b/tools/system_libs.py
@@ -233,6 +233,9 @@ def calculate(temp_files, in_temp, stdout, stderr):
'wcstol.c',
]],
['string', [
+ 'bcmp.c',
+ 'bcopy.c',
+ 'bzero.c',
'memccpy.c',
'memmem.c',
'mempcpy.c',