]> xenbits.xensource.com Git - unikraft/libs/newlib.git/commitdiff
Add stubs for C++ libraries
authorVlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro>
Thu, 21 Mar 2019 15:34:56 +0000 (15:34 +0000)
committerFelipe Huici <felipe.huici@neclab.eu>
Fri, 22 Mar 2019 14:09:33 +0000 (15:09 +0100)
This patch adds the missing stubs needed by the
C++ llvm libraries. It creates a new locale.c
file for the stubs related to the locales.
This patch adds the missing include
to stddef inside mman.h.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
Makefile.uk
include/sys/mman.h
locale.c [new file with mode: 0644]
mem.c
resource.c
time.c

index 6a918b84c7257666ffb27779caaf549295522b83..5db32b2fa94f6aebec85bee9e61f25a4dd1bfe28 100644 (file)
@@ -108,6 +108,7 @@ LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/process.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/resource.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/pty.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/time.c|glue
+LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/locale.c
 
 ################################################################################
 # Newlib/libc code -- argz
index cbedba993c50699ec44b96e6dfd9565142eb1d02..7abf57f64dde4e5550f78639f6db245194e26439 100644 (file)
@@ -30,6 +30,8 @@
 extern "C" {
 #endif
 
+#include <stddef.h>
+
 #define __NEED_mode_t
 #define __NEED_size_t
 #define __NEED_off_t
diff --git a/locale.c b/locale.c
new file mode 100644 (file)
index 0000000..c38aa3a
--- /dev/null
+++ b/locale.c
@@ -0,0 +1,26 @@
+#include <string.h>
+#include <stddef.h>
+
+int strcoll_l(const char *s1, const char *s2,
+                               locale_t locale)
+{
+       return 0;
+}
+
+size_t strxfrm_l(char *restrict s1, const char *restrict s2,
+                               size_t n, locale_t locale)
+{
+       return 0;
+}
+
+int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2,
+                               locale_t locale)
+{
+       return 0;
+}
+
+size_t wcsxfrm_l(wchar_t *restrict ws1, const wchar_t *restrict ws2,
+                               size_t n, locale_t locale)
+{
+       return 0;
+}
diff --git a/mem.c b/mem.c
index 3eb4db720c04f33b2b0b895fc60134f3cd551b0e..5870bcf7c96668f5de501194a45383e235733ea1 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -34,6 +34,7 @@
 
 #include <sys/types.h>
 #include <uk/alloc.h>
+#include <sys/mman.h>
 
 /* Forward to libucallocator calls */
 void *malloc(size_t size)
@@ -66,3 +67,8 @@ void free(void *ptr)
 {
        return uk_free(uk_alloc_get_default(), ptr);
 }
+
+int mprotect(void *addr __unused, size_t len __unused, int prot __unused)
+{
+       return 0;
+}
index f76573a1c2790c4330246b650b7f0e0d7e202607..321854f02bdd2c10e70e7f2920836692dbeded0e 100644 (file)
@@ -47,3 +47,7 @@ int setrlimit(int resource __unused, const struct rlimit *rlim __unused)
        return 0;
 }
 
+long sysconf(int name __unused)
+{
+       return 0;
+}
diff --git a/time.c b/time.c
index 84eccbab175eb5a2b71bab71f4b920659601446d..fa887bae3bb4459745def9ca38320833c93fb6b8 100644 (file)
--- a/time.c
+++ b/time.c
@@ -102,3 +102,8 @@ int nanosleep(const struct timespec *req, struct timespec *rem)
        }
        return 0;
 }
+
+int clock_gettime(clockid_t clk_id __unused, struct timespec *tp __unused)
+{
+       return 0;
+}